question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[TechDocs] - Support Mermaid Diagrams Using the Addon Framework

See original GitHub issue

Expected Behavior

Expecting techdocs/backstage to render custom JS / mermaid plugin.

image

Current Behavior

mkdocs/techdocs is not rendering custom JS / mermaid plugin; instead only the raw instructions are presented

image

Context

I’m running a custom tech-docs backend with the mermaid extension installed in the local container. For example:

Tech-docs custom container:

...
pip install --quiet \
    mkdocs==1.1.2 \
    cookiecutter==1.7.2 \
    Markdown==3.2.2 \
    pygments==2.6.1 \
    mkdocs-material \
    mkdocs-jupyter \
    mkdocs-mermaid2-plugin \
   ...

Your Environment

mkdocs-techdocs-core 0.0.13 mkdocs-plugin-mermaid 0.1.1

My mkdocs.yml config:

plugins:
  - techdocs-core
  - mermaid2

extra_javascript:
  - https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-MML-AM_CHTML
  - https://unpkg.com/mermaid/dist/mermaid.min.js

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:16
  • Comments:34 (20 by maintainers)

github_iconTop GitHub Comments

9reactions
OrkoHuntercommented, Jan 17, 2021

We’ll look more into the MkDocs mermaid2 plugin more to see how we can make it work with TechDocs.

But TechDocs loading an external Javascript from its storage and executing it, will be a security threat for a Backstage app. Hence, TechDocs is only allowed to import HTML and CSS.

One possible approach would be to make the files under extra_javascript available in Backstage/TechDocs frontend; and then when the mermaid diagram’s HTML is rendered, it would work as expected. But I’m not too sure.

8reactions
kuangpcommented, Dec 9, 2021

Still interested

Read more comments on GitHub >

github_iconTop Results From Across the Web

Release: Roadie Now Supports Mermaid Diagrams in Techdocs
We have added support for mermaid syntax in techdocs. If you would like to use mermaid diagrams, you can add the markdown_inline_mermaid ...
Read more >
backstage-plugin-techdocs-addon-mermaid - npm
Start using backstage-plugin-techdocs-addon-mermaid in your project by ... allows rendering of Mermaid diagrams within Backstage TechDocs.
Read more >
Include diagrams in your Markdown files with Mermaid
Mermaid is a JavaScript based diagramming and charting tool that takes Markdown-inspired text definitions and creates diagrams dynamically ...
Read more >
backstage-plugin-techdocs-addon-mermaid - npm package
The `backstage-plugin-techdocs-addon-mermaid` allows rendering of [Mermaid](https://mermaid-js.github.io/) diagrams within [Backstage TechDocs]( ...
Read more >
Backstage Software Catalog and Developer Platform
Create new software components in just a few steps, with your standards built-in (Scaffolder). Explore. Backstage TechDocs. by Spotify. Core Feature. A ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found