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

Render mermaid code on websites? #215

Closed
orschiro opened this issue Sep 26, 2015 · 7 comments
Closed

Render mermaid code on websites? #215

orschiro opened this issue Sep 26, 2015 · 7 comments
Labels
Type: Other Not an enhancement or a bug

Comments

@orschiro
Copy link

Dear all,

This is a more general question. I am currently trying to switch my entire digital work to plain text (i.e. Markdown) files and syntax. Thus, I really like mermaid to use plain text syntax for generating diagrams.

Is it somehow possible to add mermaid syntax to a markdown file and have it rendered on an online website instead of embedding a raster image?

Thankfully,

Robert

@knsv
Copy link
Collaborator

knsv commented Sep 26, 2015

That it is. One example is the documentation site. http://knsv.github.io/mermaid/

That site is generated from markdown to html. At page load the graph defintions (still as text inte the html) is rendered by mermaid.

Another way could be to do the markdown conversion in the browser as well. With this approach you could have markdown files as content that is loaded by a web app that generates html and displayed the result.

A good start could be to look at the documentation site though. The source files is in the docs folder.

@knsv knsv added the Type: Other Not an enhancement or a bug label Sep 26, 2015
@orschiro
Copy link
Author

Dear @knsv,

Thanks for your comment!

That site is generated from markdown to html. At page load the graph defintions (still as text inte the html) is rendered by mermaid.

I looked at the source and it is hosted on Github Pages, correct? Thus, Github Pages can render mermaid code?

~ Robert

@knsv
Copy link
Collaborator

knsv commented Sep 27, 2015

Wc!

The docs pages are served from Github Pages but the rendering is not done by Github Pages. The rendering is done in the browser. This means any site can server this kind of content. The web server only sends the graph definition in a div.

When the page has loaded mermaid starts running in the browser and looks for graph definitions. The graphs found are rendered to svg which is displayed in the content by the browser.

Hope that clarifies things.

@orschiro
Copy link
Author

orschiro commented Oct 4, 2015

Hope that clarifies things.

Indeed it does! Thank you. Basically, one just needs to load the javascript library to render the code in the browser. Cool! ツ

~ Robert

@orschiro orschiro closed this as completed Oct 4, 2015
@szrlee
Copy link

szrlee commented Jun 3, 2018

still have a question about how to render mermaid on github pages directly from jekyll markdown, etc.

@asbjornu
Copy link

asbjornu commented Oct 1, 2019

@szrlee, as mentioned in github/markup#533, that's a feature request you need to send to the GitHub support team.

@IOrlandoni
Copy link
Member

This is a 16 month old closed issue. If you have any more questions or issues, please open a new one.

@mermaid-js mermaid-js locked as spam and limited conversation to collaborators Oct 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Type: Other Not an enhancement or a bug
Projects
None yet
Development

No branches or pull requests

5 participants