Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@beoe/rehype-d2

stereobooster1.3kMIT0.5.4TypeScript support: included

rehype d2 plugin

rehype, d2

readme

@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.