remark-rehype-block-id
v1.0.3
Published
**[remark][]** plugin to support for [Obsidian][]-style inline footnotes.
Downloads
38
Maintainers
Readme
unified-block-id
remark plugin to support for Obsidian-style inline footnotes.
Install
This package is ESM only. In Node.js (version 16+), install with npm:
npm install remark-rehhype-block-idIn Deno with esm.sh:
import gfmInlineFootnote from "https://esm.sh/unified-block-id@1";In browsers with esm.sh:
<script type="module">
import gfmInlineFootnote from "https://esm.sh/unified-block-id@1?bundle";
</script>Use
Say our document example.md contains:
# Document
Here is some text with a block id ^block
Wow.…and our module example.js contains:
import rehypeStringify from "rehype-stringify";
import remarkGfm from "remark-gfm";
import { remarkBlockId, rehypeBlockId } from "unified-block-id";
import remarkParse from "remark-parse";
import remarkRehype from "remark-rehype";
import { read } from "to-vfile";
import { unified } from "unified";
const file = await unified()
.use(remarkParse)
.use(remarkBlockId)
.use(remarkRehype, { passThrough: ["blockId"] }) // IMPORTANT!
.use(rehypeBlockId)
.use(rehypeStringify)
.process(await read("example.md"));
console.log(String(file));…then running node example.js yields:
<h1>Document</h1>
<p id="^block">Here is some text with a block id </p>
<p>Wow.</p>Security
Use of remark-rehype-block-id is safe.
