JSPM

highlight.js-mermaid

0.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4
  • Score
    100M100P100Q56378F
  • License MPL-2.0

Highlight.js / lowlight grammar for Mermaid diagrams. Enables syntax highlighting in editors like Tiptap with @tiptap/extension-code-block-lowlight.

Package Exports

  • highlight.js-mermaid

Readme

Lowlight Mermaid

test Maintainability codecov Version Downloads npm bundle size

TypeScript grammar definitions for Mermaid syntax highlighting Compatible with highlight.js and lowlight, designed for editors, markdown renderers, and converters.


✨ Features


🚀 Install

pnpm add lowlight-mermaid

or

npm install lowlight-mermaid

or

yarn add lowlight-mermaid

📖 Usage

import { mermaidGrammar } from "lowlight-mermaid";
import hljs from "highlight.js/lib/core";

hljs.registerLanguage("mermaid", mermaidGrammar);

const code = `flowchart TD
  A[Christmas] -->|Get money| B(Go shopping)
  B --> C{Let me think}
  C -->|One| D[Laptop]
  C -->|Two| E[iPhone]
  C -->|Three| F[fa:fa-car Car]`;

const result = hljs.highlight(code, { language: "mermaid" });

console.log(result.value);

🙏 Acknowledgments


📜 License

Licensed under MPL-2.0 open-source license.



Support my work via GitHub Sponsors or explore courses.

with 💖 by Mayank Kumar Chaudhari