-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Add support for Goat and Mermaid diagrams (via Goldmark) code fences #9521
Comments
Hmm... It's a good idea. As I have quickly implemented the diagrams is to check if the All the diagram types would need some kind of processing, but it's probably suboptimal to do that where we do it today (as we often end up with double implementation). So, given the Goat example:
{{ $svg := diagrams.Goat .Content }}
<div>
{{ $svg.Content }}
</div> The above is just jotted down without much thought. But if we had:
Which should probably also have a fall back template for people wanting to handle all code highlighting via custom template:
|
Perhaps irrelevant, but there's also the (undocumented) |
Probably better:
|
I hijacked Given these two markdown examples:
We would pass
Key points:
Nice to have: an |
@bep the proposed codeblock hook templates would be very handy in terms of preserving the authoring experience and compatibility of native markdown. Two cases in particular come to mind:
The latter use case would pair really nicely with your Would also be good to normalize language aliases such that templates defined as |
How would we mantain such a mapping? Have you seen the list of Chroma lexers? We're going to do the above, but the prime use case will still be the diagram langs, I'm not going some extra thousand miles to maintain a database of all code formats of the world and their aliases... |
@bep right, the mappings are maintained by Chroma. I was thinking you could consistently map template filenames with the langs defined in the authored codeblock using this method: Otherwise you'd have to rely on content authors being consistent with the aliases they use. |
@marshall007 thanks, I did not know about that API, will use it. |
This is now merged. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
People will most likely want to adjust the template for this, so I will add some "hooks". I will add some built-in defaults for these, but I need some help with the naming; below
_default/_markup
:The
render-diagram-mermaid-post.html
would be invoked after all the Mermaid diagrams on a page has been rendered (inclusion of JS)./cc @jmooring @regisphilibert
See #7765
The text was updated successfully, but these errors were encountered: