Syntax advice for tikz diagram plugin #1408
-
I need some advice after looking at other plugins that allow one to render diagrams (remark-mermaidjs, remark-smcat, remark-plantuml). I am working on a plugin to try making it easier to render tikz diagrams, based on node-tikzjax. I am planning to implement this as follows (if my understanding is wrong, please correct me):
Now, the plugins mentioned above all work by bolting their functionality on top of code blocks. E.g. one makes What I'd like to do instead is to give the user the option to either do it the code block way or to use custom blocks as provided by remark-directive. I think that's better too because it makes things configurable for the user. So my real question is, is it a good idea to "depend" on the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Don’t create a remark plugin for this. Create a rehype plugin instead. I recommend to have a look at You can’t really use directives for this. Content between directives are markdown and will be parsed as such. I investigated this for Your point about code blocks being for code is fair, but code blocks are also your only real option. Markdown code blocks support metadata. You could leverage that. ```language Everything after the language followed by a space is meta
Your code
``` So the syntax could be something like: ```tikz render
Diagram code
``` This meta is available on the |
Beta Was this translation helpful? Give feedback.
Don’t create a remark plugin for this. Create a rehype plugin instead. I recommend to have a look at
rehype-mermaid
You can’t really use directives for this. Content between directives are markdown and will be parsed as such. I investigated this for
rehype-mermaid
, because some platforms use a directive-like syntax for Mermaid diagrams.Your point about code blocks being for code is fair, but code blocks are also your only real option. Markdown code blocks support metadata. You could leverage that.
So the syntax could be something like:
This meta is available on the
<code>
or…