0.0.2 • Published 3 years ago

remarkable-auto-heading-links v0.0.2

Weekly downloads
-
License
MPL-2.0
Repository
github
Last release
3 years ago

Automatic Remarkable Heading Links

This is a Remarkable plugin, that transforms the headings into headings with ids and links so that you can share # links.

# Hello, World!

In a normal Markdown compile, the above title will compile to:

<h1>hello, world!</h1>

This plugin, transforms the headings and adds ids and links to them. So the above example, compiles to:

<h1 id="hello-world"><a href="#hello-world">Hello, World!</a></h1>

It's that simple!

How to use?

Install the package:

npm install --save remarkable-auto-heading-id

Then use it like:

const { Remarkable } =
    require( "remarkable" )
const { addIDToAllMarkdownHeaders } =
    require( "remarkable-auto-heading-links" )

const md =
    new Remarkable( remarkSettings )
        .use( addIDToAllMarkdownHeaders )

const html =
    md.render("# has links!")