JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 30
  • Score
    100M100P100Q71028F
  • License MIT

rehype d2 plugin

Package Exports

  • @beoe/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.