mirror of
https://github.com/outline/outline.git
synced 2026-11-21 05:24:03 +03:00
- 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>
25 lines
1.1 KiB
TypeScript
25 lines
1.1 KiB
TypeScript
import { getRefractorLangForLanguage, getLabelForLanguage } from "./code";
|
|
|
|
describe("getRefractorLangForLanguage", () => {
|
|
it("should return the correct lang identifier for a given language", () => {
|
|
expect(getRefractorLangForLanguage("javascript")).toBe("javascript");
|
|
expect(getRefractorLangForLanguage("mermaid")).toBe("mermaid");
|
|
expect(getRefractorLangForLanguage("mermaidjs")).toBe("mermaid");
|
|
expect(getRefractorLangForLanguage("xml")).toBe("markup");
|
|
expect(getRefractorLangForLanguage("unknown")).toBeUndefined();
|
|
expect(getRefractorLangForLanguage("")).toBeUndefined();
|
|
});
|
|
});
|
|
|
|
describe("getLabelForLanguage", () => {
|
|
it("should return the correct human-readable label for a given language", () => {
|
|
expect(getLabelForLanguage("javascript")).toBe("JavaScript");
|
|
expect(getLabelForLanguage("mermaid")).toBe("Mermaid");
|
|
expect(getLabelForLanguage("mermaidjs")).toBe("Mermaid");
|
|
expect(getLabelForLanguage("xml")).toBe("XML");
|
|
expect(getLabelForLanguage("unknown")).toBe("Plain text");
|
|
expect(getLabelForLanguage("none")).toBe("Plain text");
|
|
expect(getLabelForLanguage("")).toBe("Plain text");
|
|
});
|
|
});
|