{"id":30236855,"url":"https://github.com/hkato/markdown-mermaid-cli","last_synced_at":"2026-02-23T02:37:33.960Z","repository":{"id":287786365,"uuid":"965457405","full_name":"hkato/markdown-mermaid-cli","owner":"hkato","description":"Mermaid extension for Python-Markdown using mermaid-cli.","archived":false,"fork":false,"pushed_at":"2025-11-20T22:38:20.000Z","size":180,"stargazers_count":4,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-20T23:19:06.697Z","etag":null,"topics":["diagram","markdown","mermaid","mkdocs"],"latest_commit_sha":null,"homepage":"https://hkato.github.io/markdown-mermaid-cli/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hkato.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-04-13T07:54:37.000Z","updated_at":"2025-11-20T22:36:48.000Z","dependencies_parsed_at":"2025-08-15T01:07:40.675Z","dependency_job_id":"4a0f5248-fc0a-42a3-83dc-8afa0dec5192","html_url":"https://github.com/hkato/markdown-mermaid-cli","commit_stats":null,"previous_names":["hkato/markdown-mermaid-cli","hkato/markdown-mermaid-data-uri"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/hkato/markdown-mermaid-cli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hkato%2Fmarkdown-mermaid-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hkato%2Fmarkdown-mermaid-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hkato%2Fmarkdown-mermaid-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hkato%2Fmarkdown-mermaid-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hkato","download_url":"https://codeload.github.com/hkato/markdown-mermaid-cli/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hkato%2Fmarkdown-mermaid-cli/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29735759,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-23T02:24:00.660Z","status":"ssl_error","status_checked_at":"2026-02-23T02:22:56.087Z","response_time":90,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["diagram","markdown","mermaid","mkdocs"],"created_at":"2025-08-15T01:03:06.801Z","updated_at":"2026-02-23T02:37:33.950Z","avatar_url":"https://github.com/hkato.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [markdown-mermaid-cli](https://hkato.github.io/markdown-mermaid-cli/)\n\n[![PyPI version](https://img.shields.io/pypi/v/markdown-mermaid-cli)](https://pypi.org/project/markdown-mermaid-cli/)\n![License](https://img.shields.io/pypi/l/markdown-mermaid-cli)\n![Python versions](https://img.shields.io/pypi/pyversions/markdown-mermaid-cli)\n\n[Mermaid][mermaid] extension for [Python-Markdown][python-markdown] using [Mermaid-CLI][mermaid-cli].\n\nThis extension converts Mermaid diagram code blocks into Base64 encoded [data: URI][data-uri].\nThis enables PDF generation with tools like [MkDocs to PDF][mkdocs-to-pdf]/[WeasyPrint][wasyprint]\nwithout requiring client-side JavaScript.\n\n## Install\n\n```sh\npip install markdown-mermaid-cli\n```\n\n## Requirements\n\n### Mermaid CLI\n\n\u003e Chrome or Chromium is required to run Mermaid-CLI.\n\n```sh\nnpm install @mermaid-js/mermaid-cli\n```\n\nor\n\n```sh\nnpm install --global @mermaid-js/mermaid-cli\n```\n\n## Usage\n\n- code block start with \u003ccode\u003e```mermaid\u003c/code\u003e\n- code block end with \u003ccode\u003e```\u003c/code\u003e\n\noptions:\n\n```markdown\nformant=[svg|png] {img attribute}=\"value\" {cli option}=\"value\"`\n```\n\n- format (optional): Output image format (defaults to svg)\n- img attribute (optional): alt, width, height, class, id, style, title\n- cli option (optional): theme, width, height, backgroundColor, svgId, scale (refer to `mmdc -h`)\n\n### [MkDocs][mkdocs] Integration\n\n```yaml\n# mkdocs.yml\nmarkdown_extensions:\n  - markdown_mermaid_cli\n```\n\nor with options:\n\n```yaml\n# mkdocs.yml\nmarkdown_extensions:\n  - markdown_mermaid_cli:\n      default_format: png     # svg or png, default svg\n```\n\n### [Pelican][pelican] Integration\n\n```py\n# pelicanconf.py\nMARKDOWN = {\n    'extension_configs': {\n        'markdown.extensions.codehilite': {'css_class': 'highlight'},\n        'markdown.extensions.extra': {},\n        'markdown_mermaid_cli': {},             # Add this\n    },\n    'output_format': 'html5',\n}\n```\n\n### Python code\n\n````python\nimport markdown\nfrom markdown_mermaid_cli import MermaidExtension\n\nmarkdown_text = \"\"\"```mermaid\nsequenceDiagram\n    participant Alice\n    participant Bob\n    Bob-\u003e\u003eAlice: Hi Alice\n    Alice-\u003e\u003eBob: Hi Bob\n```\"\"\"\n\nhtml_output = markdown.markdown(\n    markdown_text, extensions=[MermaidExtension()]\n)\n\nprint(html_output)\n````\n\n```html\n\u003cp\u003e\u003cimg src=\"data:image/svg+xml;base64,PHN2ZyBhcmlhLXJvbGVkZXNjcmlwdGlvbj0ic2VxdWVuY2UiIHJvbGU\n9ImdyYXBoaWNzLWRvY3VtZW50IGRvY3VtZW50IiB2aWV3Qm94PSItNTAgLTEwIDc1MCA1NzQiIHN0eWxlPSJtYXgtd2lkd\nGg6IDc1MHB4OyBiYWNrZ3JvdW5kLWNvbG9yOiB3aGl0ZTsiIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk\n...\n...\n...\nIHgxPSIyNzYiLz48L3N2Zz4=\" \u003e\u003c/p\u003e\n```\n\n## Process flow\n\n```mermaid\nsequenceDiagram\n    participant application as Application\u003cbr/\u003e(eg MkDocs)\n    participant markdown as Python Markdown\n    participant extension as MermaidDataURIExtension\n    participant engine as Mermaid CLI\n\n    application-\u003e\u003emarkdown: Markdown + Mermaid\n    markdown-\u003e\u003eextension: Preprocessor\n    extension-\u003e\u003eengine: Mermaid\n    engine--\u003e\u003eengine: Convert\n    engine--\u003e\u003eextension: Image Data\n    extension--\u003e\u003eextension: Base64 encode\n    extension--\u003e\u003emarkdown: Markdown + data URI image\n    markdown--\u003e\u003eapplication: HTML + data URI image\n```\n\n[mermaid]: https://mermaid.js.org/\n[python-markdown]: https://python-markdown.github.io/\n[mermaid-cli]: https://github.com/mermaid-js/mermaid-cli\n[data-uri]: https://developer.mozilla.org/en-US/docs/Web/URI/Reference/Schemes/data\n[mkdocs-to-pdf]: https://mkdocs-to-pdf.readthedocs.io/\n[wasyprint]: https://weasyprint.org/\n[mkdocs]: https://www.mkdocs.org/\n[pelican]: https://getpelican.com/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhkato%2Fmarkdown-mermaid-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhkato%2Fmarkdown-mermaid-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhkato%2Fmarkdown-mermaid-cli/lists"}