Comments (7)
Hey, thanks for your note. Given that Github now supports mermaid
natively, I might add first-class support of this feature in a future release. In the meantime, something like this will work:
<head>
...
<!-- Load mermaid -->
<script defer src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
<script type="module" src="https://cdn.jsdelivr.net/gh/zerodevx/zero-md@2/dist/zero-md.min.js"></script>
</head>
<body>
<!-- Render zero-md in light dom -->
<zero-md id="app" src="mermaid.md" no-shadow manual-render></zero-md>
<script>
app.addEventListener('zero-md-ready', async () => {
// Create custom marked renderer
const renderer = new marked.Renderer()
renderer.code = function (code, lang) {
return lang === 'mermaid'
? `<div class="mermaid">${code}</div>`
: `<pre><code>${code}</code></pre>`
}
await app.render({ renderer })
mermaid.init()
})
</script>
</body>
Here's a demo: https://plnkr.co/edit/Q64k8e498RfGDdlC
from zero-md.
The demo linked below uses SyncHTML.io. (I am building it.)
Wow! That's a cool project - looks really good!
the approach suggested above breaks encapsulation.
Unfortunately, yes, mainly because of how mermaid
works. For now, the markdown must be rendered into light dom - until first-class support is eventually added into zero-md
(soon!). 😞
from zero-md.
amazing library, looking forward to this feature
from zero-md.
This was exactly what I was looking for! Awesome project, thanks a lot :)
from zero-md.
@zerodevx – the approach suggested above breaks encapsulation.
<zero-md>
is the only third-party custom element I have seen that behaves like the standard elements of HTML in that it does not gain attributes on getting connected to a document or leaks state in other weird ways.
Demo of just how awesome <zero-md>
is
The demo linked below uses RTCode.io. (I am building it.)
See what we mean with the following steps:
- Go to
md.rt.ht/?
👈🏻 - Press ↑/↓ keys
- Notice the video does not restart on edit.
This is all because you are doing custom elements right™ ❤️!
SyncHTML.io – the next-gen, no-reload, real-time web playground with instant two-way input ⇄ output sync.
(try, learn more)
from zero-md.
RTCode.io ❤️ <zero-md>
Dear @zerodevx,
We have dedicated the short domain md.rt.ht
to the latest stable version of <zero-md>
!
It is the shortest domain you can get that serves as an editable quick starting point! See below
In the address bar of your browser:
type | get |
---|---|
md.rt.ht/? |
editor |
md.rt.ht |
output |
All you need is a single /?
to edit your edge-deployed syncs!
Just hit Ctrl+S1 to update it in 275+ cities around the world!
(1 RTEdge.net restricts saves/updates to Elefunc, Inc. until we reach public beta.)
Best Regards,
@CetinSert
from zero-md.
First class support for mermaid diagrams (into the shadow dom no less) is now available in V3, so do check it out!
from zero-md.
Related Issues (20)
- Thanks a ton!
- Parsing img tags in md [ERROR with src] HOT 1
- fallback markdown script renders as code block HOT 1
- Marked.js v5 support HOT 2
- github markdown emoji HOT 3
- Inline markdown doesn't work HOT 2
- zero-md-copy to clipboard HOT 1
- v3 Question: Is there an easy way to force the theme to be light or dark? HOT 3
- BUG: `goto` (scroll to selected element) broken when `no-shadow` enabled HOT 2
- Discussion: Anchor.js usability (for on-hover anchor links) HOT 5
- Mathjax zero-md@{1,2} bug HOT 3
- Mathjax no-shadow window.ZeroMdConfig HOT 2
- Render Mathjax on content change HOT 2
- Is there a way to use mathjax while still supporting shadow dom? HOT 2
- Does zero-md support admonition marked plug-in? HOT 7
- Parse/Render text within HTML tags HOT 2
- prism.js seems to not recognize C++? HOT 3
- Mermaid Support Broken Since Version 2.5.1 HOT 3
- Display table of content TOC HOT 4
- Markdown not translated into HTML 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 zero-md.