import type { MarkdownOptions } from 'vitepress'; import { defineConfig } from 'vitepress'; import { version } from '../../../package.json'; import MermaidExample from './mermaid-markdown-all.js'; const allMarkdownTransformers: MarkdownOptions = { // the shiki theme to highlight code blocks theme: { light: 'github-light', dark: 'github-dark', }, config: (md) => { MermaidExample(md); }, }; export default defineConfig({ lang: 'en-US', title: 'Mermaid', description: 'Create diagrams and visualizations using text and code.', base: '/', markdown: allMarkdownTransformers, ignoreDeadLinks: [ // ignore all localhost links /^https?:\/\/localhost/, ], head: [ ['link', { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }], [ 'script', { defer: 'true', 'data-domain': 'mermaid.js.org', // All tracked stats are public and available at https://p.mermaid.live/mermaid.js.org src: 'https://p.mermaid.live/js/script.tagged-events.outbound-links.js', }, ], ], themeConfig: { nav: nav(), editLink: { pattern: ({ filePath, frontmatter }) => { if (typeof frontmatter.editLink === 'string') { return frontmatter.editLink; } return `https://github.com/mermaid-js/mermaid/edit/develop/packages/mermaid/src/docs/${filePath}`; }, text: 'Edit this page on GitHub', }, sidebar: { '/': sidebarAll(), }, outline: { level: 'deep', }, socialLinks: [ { icon: 'github', link: 'https://github.com/mermaid-js/mermaid' }, { icon: 'discord', link: 'https://discord.gg/AgrbSrBer3', }, { icon: { svg: '', }, link: 'https://www.mermaidchart.com/', }, ], }, }); // Top (across the page) menu function nav() { return [ { text: 'Docs', link: '/intro/', activeMatch: '/intro/' }, { text: 'Tutorials', link: '/ecosystem/tutorials', activeMatch: '/ecosystem/tutorials', }, { text: 'Integrations', link: '/ecosystem/integrations-community', activeMatch: '/ecosystem/integrations-community', }, { text: 'Contributing', link: '/community/intro', activeMatch: '/community/', }, { text: 'Latest News', link: '/news/announcements', activeMatch: '/announcements', }, { text: version, items: [ { text: 'Changelog', link: 'https://github.com/mermaid-js/mermaid/releases', }, ], }, { text: '💻 Live Editor', link: 'https://mermaid.live', }, ]; } function sidebarAll() { return [ { text: '📔 Introduction', collapsed: false, items: [ { text: 'About Mermaid', link: '/intro/' }, { text: 'Getting Started', link: '/intro/getting-started' }, { text: 'Syntax and Configuration', link: '/intro/syntax-reference' }, ], }, ...sidebarSyntax(), ...sidebarEcosystem(), ...sidebarConfig(), ...sidebarCommunity(), ...sidebarNews(), ]; } function sidebarSyntax() { return [ { text: '📊 Diagram Syntax', collapsed: false, items: [ { text: 'Flowchart', link: '/syntax/flowchart' }, { text: 'Sequence Diagram', link: '/syntax/sequenceDiagram' }, { text: 'Class Diagram', link: '/syntax/classDiagram' }, { text: 'State Diagram', link: '/syntax/stateDiagram' }, { text: 'Entity Relationship Diagram', link: '/syntax/entityRelationshipDiagram', }, { text: 'User Journey', link: '/syntax/userJourney' }, { text: 'Gantt', link: '/syntax/gantt' }, { text: 'Pie Chart', link: '/syntax/pie' }, { text: 'Quadrant Chart', link: '/syntax/quadrantChart' }, { text: 'Requirement Diagram', link: '/syntax/requirementDiagram' }, { text: 'Gitgraph (Git) Diagram', link: '/syntax/gitgraph' }, { text: 'C4 Diagram 🦺⚠️', link: '/syntax/c4' }, { text: 'Mindmaps', link: '/syntax/mindmap' }, { text: 'Timeline', link: '/syntax/timeline' }, { text: 'ZenUML', link: '/syntax/zenuml' }, { text: 'Sankey 🔥', link: '/syntax/sankey' }, { text: 'XY Chart 🔥', link: '/syntax/xyChart' }, { text: 'Block Diagram 🔥', link: '/syntax/block' }, { text: 'Packet 🔥', link: '/syntax/packet' }, { text: 'Other Examples', link: '/syntax/examples' }, ], }, ]; } function sidebarConfig() { return [ { text: '⚙️ Deployment and Configuration', collapsed: false, items: [ { text: 'Configuration', link: '/config/configuration' }, { text: 'API-Usage', link: '/config/usage' }, { text: 'Mermaid API Configuration', link: '/config/setup/README' }, { text: 'Mermaid Configuration Options', link: '/config/schema-docs/config' }, { text: 'Directives', link: '/config/directives' }, { text: 'Theming', link: '/config/theming' }, { text: 'Math', link: '/config/math' }, { text: 'Accessibility', link: '/config/accessibility' }, { text: 'Mermaid CLI', link: '/config/mermaidCLI' }, { text: 'FAQ', link: '/config/faq' }, ], }, ]; } function sidebarEcosystem() { return [ { text: '📚 Ecosystem', collapsed: false, items: [ { text: 'Mermaid Chart', link: '/ecosystem/mermaid-chart' }, { text: 'Tutorials', link: '/ecosystem/tutorials' }, { text: 'Integrations - Community', link: '/ecosystem/integrations-community' }, { text: 'Integrations - Create', link: '/ecosystem/integrations-create' }, ], }, ]; } function sidebarCommunity() { return [ { text: '🙌 Contributing', collapsed: false, items: [ { text: 'Getting Started', link: '/community/intro' }, { text: 'Contributing to Mermaid', link: '/community/contributing' }, { text: 'Adding Diagrams', link: '/community/new-diagram' }, { text: 'Questions and Suggestions', link: '/community/questions-and-suggestions' }, { text: 'Security', link: '/community/security' }, ], }, ]; } function sidebarNews() { return [ { text: '📰 Latest News', collapsed: false, items: [ { text: 'Announcements', link: '/news/announcements' }, { text: 'Blog', link: '/news/blog' }, ], }, ]; } /** * Return a string that puts together the pagePage, a '#', then the given id * @returns the fully formed path */ function pathToId(pagePath: string, id = ''): string { return pagePath + '#' + id; }