Files
outline/shared/editor/lib/isCode.ts
T
Tom MoorandClaude Sonnet 4.5 221a7ce19e Change Mermaid code block language from "mermaidjs" to "mermaid" (#11132)
- Add "mermaid" as the primary language identifier for new diagrams
- Maintain backward compatibility with existing "mermaidjs" blocks
- Create isMermaid() helper function for consistent language checking
- Update all Mermaid-related code to support both language variants
- Update CSS selectors to style both "mermaid" and "mermaidjs" blocks
- Update server-side HTML export to handle both language formats
- Add tests to verify backward compatibility

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-10 12:30:56 -05:00

16 lines
516 B
TypeScript

import type { Node } from "prosemirror-model";
export function isCode(node: Node) {
return node.type.name === "code_block" || node.type.name === "code_fence";
}
/**
* Returns true if the node is a code block with Mermaid language (supports both "mermaid" and "mermaidjs").
*
* @param node The node to check.
* @returns true if the node is a Mermaid code block.
*/
export function isMermaid(node: Node) {
return isCode(node) && (node.attrs.language === "mermaid" || node.attrs.language === "mermaidjs");
}