Skip to content

Remark plugin to parse Attribute List Definitions and Inline Attribute Lists from Kramdown

License

Notifications You must be signed in to change notification settings

utelecon/remark-attribute-list

Repository files navigation

remark-attribute-list

Remark plugin to parse Attribute List Definitions and Inline Attribute Lists from Kramdown.

Install

This package is ESM only. In Node.js, install with npm:

npm install remark-attribute-list

Use

Say our document input.md contains:

# Title
{:#title}

{:outlink:target="blank" rel="noopener noreferrer"}

See [GitHub](https://github.com/){:outlink} for more information.

And our module main.js looks like this:

import rehypeStringify from 'rehype-stringify'
import remarkAttributeList from 'remark-attribute-list'
import remarkParse from 'remark-parse'
import remarkRehype from 'remark-rehype'
import {read} from 'to-vfile'
import {unified} from 'unified'

const processor = unified()
	.use(remarkParse)
	.use(remarkAttributeList)
	.use(remarkRehype)
	.use(rehypeStringify);
const file = await processor.process(await read('input.md'))

console.log(String(file))

Running node main.js yields:

<h1 id="title">Title</h1>
<p>See <a href="https://github.com/" target="blank" rel="noopener noreferrer">GitHub</a> for more information.</p>

API

This package exports no identifiers. The default export is remarkAttributeList.

unified().use(remarkAttributeList)

Add support for Attribute List Definitions and Inline Attribute Lists from Kramdown.

About

Remark plugin to parse Attribute List Definitions and Inline Attribute Lists from Kramdown

Resources

License

Stars

Watchers

Forks

Packages

No packages published