Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/juliendargelos/markdown-it-shift-headings

markdown-it plugin to shift headings by given offset.
https://github.com/juliendargelos/markdown-it-shift-headings

Last synced: 18 days ago
JSON representation

markdown-it plugin to shift headings by given offset.

Awesome Lists containing this project

README

        

# markdown-it-shift-headings

> markdown-it plugin to shift headings by given offset.

## Install

With yarn:

```bash
yarn add markdown-it-shift-headings
```

With npm:

```bash
npm install markdown-it-shift-headings --save
```

## Usage

```javascript
import MarkdownIt from 'markdown-it'
import shiftHeadings from 'markdown-it-shift-headings'

const content = `
# Lorem
## Ipsum
### Dolor
#### Sit
##### Amet
###### Consectetur
`

new MarkdownIt()
.use(shiftHeadings) // Using default offset: 1
.render(content)

//

Lorem


//

Ipsum


//

Dolor


//
Sit

//
Amet

//
Consectetur

new MarkdownIt()
.use(shiftHeadings, { offset: 2 }) // Using custom offset: 2
.render(content)

//

Lorem


//

Ipsum


//
Dolor

//
Sit

//
Amet

//
Consectetur

````