Skip to content

Syntax advice for tikz diagram plugin #1408

Answered by remcohaszing
dominiwe asked this question in General
Discussion options

You must be logged in to vote

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.

```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 <code> or

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@dominiwe
Comment options

@remcohaszing
Comment options

@dominiwe
Comment options

@wooorm
Comment options

@remcohaszing
Comment options

Answer selected by dominiwe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants