Comments (7)
Does this exist? I came here looking to see if inline SVG in HTML was available or in the works.
If anybody is looking to convert Markdown to plain HTML with support for ```mermaid
code blocks, @remcohaszing has recently released https://github.com/remcohaszing/rehype-mermaidjs, which I'd highly recommend!
Of interest, it has a bunch of useful strategies, i.e. 'inline-svg'
, which renders the Mermaid diagram on the server, then inlines it into the HTML, or 'pre-mermaid'
, which will allow you to instead render the Mermaid diagram on the client!
Plus, since it's a rehype
plugin, it integrates pretty easily with a bunch of Markdown to HTML site generators, like Docusaurus or Astro, in case you want to convert multiple markdown files into a single website (and/or you want much prettier HTML)!
from mermaid-cli.
I think the easiest approach is to embed the JS file from a CDN, or render to svg and drop it in the page. The goal would be to preserve all the click-handling and CSS-formatting options you can use with the web version, in a standalone file.
output.html (from Mermaid usage docs)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
</head>
<body>
<div class="mermaid">
graph LR
A --- B
B-->C[fa:fa-ban forbidden]
B-->D(fa:fa-spinner);
</div>
<script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
<script>mermaid.initialize({startOnLoad:true});</script>
</body>
</html>
output.html embedded svg
<svg>
output here...
</svg>
It doesn't look like mermaid core has a bin
reference in package.json, so you'd have to create a JS file to programmatically interface with it (including reading the graph contents from the fileystem). The CLI seems like the natural place to put file-oriented APIs since it already understands these concepts.
from mermaid-cli.
@alexkrolick Thank you for your feature proposal. I would like to ask that you include an example of such .mmd file and how an output would look like. Regarding the design of the feature, currently I am not sure if the CLI is the right place for the feature. Would it not be a case, that anyone, using mermaid core library (programmatically), like to have the same feature support? CLI is a very thin and not the only client of the https://github.com/mermaid-js/mermaid core library. If you agree, please, move this feature request to the https://github.com/mermaid-js/mermaid project.
from mermaid-cli.
OK. Would you be interested in working on this feature? The help is appreciated. 🙂
from mermaid-cli.
Yes, I think I can work on it
from mermaid-cli.
Does this exist? I came here looking to see if inline SVG in HTML was available or in the works.
from mermaid-cli.
@chrismajewski Sorry, have not had time to come back to this issue on my end
from mermaid-cli.
Related Issues (20)
- No charts found when space between opening code fence and language name HOT 3
- Upgrade puppeteer HOT 1
- Unable to resolve types with TypeScript 5.3.3 / TSC 9.2.0 HOT 1
- Apply styles from inside mermaid graphs
- Bug: CSS Styling Not Applied to SVG (only PNG / static image)
- Add types for exports
- How can I configure maxEdges using the CLI? (Error: Too many edges) HOT 1
- Error: net::ERR_ACCESS_DENIED on /@mermaid-js/mermaid-cli/dist/index.html
- Error: Could not find Chromium (rev. 1108766) HOT 7
- Syntax Error in Mermaid-cli tool HOT 1
- background of edge label is white in pdf from flowchart
- Missing description in `-h, --help`
- Custom image output for .md file input
- SyntaxError: The requested module `@mermaid-js/mermaid-cli` does not provide an export named 'run' (via SyntaxError) HOT 1
- Formatting of diagram is changed when exported to svg, pdf or png
- Could not find Chromium (rev. 1108766) HOT 4
- Upgrade mermaid to 10.9.0 (Latex support) HOT 2
- Write output to stdout
- Document mermaid-cli release procedure
- mmdc not generating labels for SVG outputs HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mermaid-cli.