1.0.1 • Published 6 months ago
uniorg-slug v1.0.1
uniorg-slug
uniorg plugin to add anchors headings using GitHub's algorithm. Similar to rehype-slug but respects org-mode's CUSTOM_ID
(as org-html-export
).
Install
npm install uniorg-slug
Use
import { unified } from 'unified';
import uniorgParse from 'uniorg-parse';
import { uniorgSlug } from 'uniorg-slug';
import uniorg2rehype from 'uniorg-rehype';
import html from 'rehype-stringify';
const node = unified()
.use(uniorgParse)
.use(uniorgSlug)
.use(uniorg2rehype)
.use(html)
.processSync(`
* headline
** nested headline
:PROPERTIES:
:CUSTOM_ID: blah
:END:
** headline
:PROPERTIES:
:ID: my-id
:END:
~id~ property is ignored.
`);
console.log(node.toString());
will output:
<h1 id="headline">headline</h1>
<h2 id="blah">nested headline</h2>
<h2 id="headline-1">headline</h2>
<p><code class="inline-code">id</code> property is ignored.</p>
License
1.0.1
6 months ago
1.0.0
1 year ago
0.5.9
1 year ago
0.5.8
1 year ago
0.5.7
1 year ago
0.5.6
1 year ago
0.5.5
2 years ago
0.5.4
2 years ago
0.5.3
2 years ago
0.5.2
2 years ago
0.5.0
2 years ago
0.5.1
2 years ago
0.4.8
2 years ago
0.4.7
3 years ago
0.4.6
3 years ago
0.4.5
3 years ago
0.4.4
3 years ago
0.4.3
3 years ago
0.4.0
3 years ago
0.3.1
3 years ago
0.3.0
3 years ago
0.2.3
3 years ago
0.2.1
3 years ago
0.2.2
3 years ago
0.2.0
3 years ago
0.1.25
3 years ago
0.1.24
3 years ago
0.1.23
3 years ago