Skip to content

Tag

Global configuration:

use(rehypeDiagram, {
tag: "...", // one of 3 options
});

or local configuration

```some-diagram tag=...
diagram text
```

img is a default option. Ignored for strategy=inline

Options

img

<figure class="beoe"><img src="..." width="..." height="..." /></figure>

iframe

<figure class="beoe">
<iframe src="..." width="..." height="..." title="..."></iframe>
</figure>

Note: there is also allowfullscreen.

embed

<figure class="beoe">
<embed src="..." width="..." height="..." title="..."></embed>
</figure>

Strategy vs Tag

inlinedata-urlfile
svg (1)yes (only possible option)nono
imgnoyes (default)yes (default)
iframe, embednoyesyes
  • (1) not an actual option

Pros and cons

svg (inline)imgiframe or embed
Searchable textyesnoyes
Linksyesnoyes with caveats (1)
Interactivity with JS (2)yesnoyes with caveats (3)
Can be styled with CSSyesnono
CSS conflictspossiblenono
alt="..." or title="..."noyesyes
Embedded images and fontsyesyes with caveats (4)yes
@beoe/pan-zoomyesyesyes with caveats (5)
  • (1) Links require target=_top, iframe may require allow-top-navigation
  • (2) This includes link previews
  • (3) It is possible to access iframe content via JS, but I suspect it will have issues
    • with CSP
    • embed, it seems, doesn’t have DOM
    • there probably will be issues with @floating-ui/dom
  • (4) Work only if images inlined (via data-url)
  • (5) gestures don’t work (at least in the current implementation), buttons work though