Skip to content

Latest commit

 

History

History
36 lines (26 loc) · 652 Bytes

README.md

File metadata and controls

36 lines (26 loc) · 652 Bytes

@beoe/rehype-d2

Rehype plugin to generate d2 diagrams in place of code fences. This:

```d2
x -> y: hello world
```

will be converted to

<figure class="beoe d2">
  <svg>...</svg>
</figure>

which can look like this:

example of how generated diagram looks

Usage

import rehypeD2 from "@beoe/rehype-d2";

const html = await unified()
  .use(remarkParse)
  .use(remarkRehype)
  .use(rehypeD2)
  .use(rehypeStringify)
  .process(`markdown`);

Online documentation provides more details.