Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Mermaid diagrams & charts for content. #553

Closed
1 of 2 tasks
JeanMeche opened this issue Jul 21, 2023 · 2 comments · Fixed by #555
Closed
1 of 2 tasks

Support for Mermaid diagrams & charts for content. #553

JeanMeche opened this issue Jul 21, 2023 · 2 comments · Fixed by #555
Labels
enhancement New feature or request

Comments

@JeanMeche
Copy link
Contributor

Which scope/s are relevant/related to the feature request?

content

Information

Mermaidjs is a quite famous lib to create diagrams & charts from a markdown-like format.

I would be a great addition to add the support for it to the Analog 👍

Describe any alternatives/workarounds you're currently using

No response

I would be willing to submit a PR to fix this issue

  • Yes
  • No
@JeanMeche JeanMeche added the enhancement New feature or request label Jul 21, 2023
@brandonroberts
Copy link
Member

Interesting! What would supporting this look like? A different content renderer?

@JeanMeche
Copy link
Contributor Author

I was thinking of somewhat extending the exisiting renderer. mermaid diagrams can be fully integrated into markdown files.

Unfortunately I stumble upon an issue while doing some tests. Mermaid is calling document while initialization which lead me to this issue : mermaid-js/mermaid#3650. It's not ready to run on node yet.

So for now It can only init on the client side. Mermaid's doc suggests an integration for marked with :

const renderer = new marked.Renderer();
renderer.code = function (code, language) {
  if (code.match(/^sequenceDiagram/) || code.match(/^graph/)) {
    return '<pre class="mermaid">' + code + '</pre>';
  } else {
    return '<pre><code>' + code + '</code></pre>';
  }
};

We could include that change directly into the MarkedSetupService but the mermaid still need to be bootstraped on the client.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants