Miss any of our Open RFC calls?Watch the recordings here! »

remark-normalize-headings

2.0.0 • Public • Published

remark-normalize-headings

Build Coverage Downloads Size Sponsors Backers Chat

remark plugin to make sure that there is only one top-level heading in a document by adjusting heading depths accordingly.

Providing multiple top-level headings per single Markdown document is confusing for tools that assume that there is only a single top-level heading that contains some meta-information (usually title) about the document.

Install

npm:

npm install remark-normalize-headings

Use

Say we have the following file, example.md:

Title
 
Description
 
## Usage
 
### Example
 
## API
 
Related

And our script, example.js, looks as follows:

var vfile = require('to-vfile')
var remark = require('remark')
var normalizeHeadings = require('remark-normalize-headings')
 
remark()
  .use(normalizeHeadings)
  .process(vfile.readSync('example.md'), function(err, file) {
    if (err) throw err
    console.log(String(file))
  })

Now, running node example yields:

Title
 
## Description
 
### Usage
 
#### Example
 
### API
 
## Related

API

remark().use(normalizeHeadings)

Make sure that there is only one top-level heading in a document by adjusting heading depths accordingly.

Security

Use of remark-normalize-headings does not involve rehype (hast) or user content so there are no openings for cross-site scripting (XSS) attacks.

Related

Contribute

See contributing.md in remarkjs/.github for ways to get started. See support.md for ways to get help.

This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.

License

MIT © Eugene Sharygin

Install

npm i remark-normalize-headings

DownloadsWeekly Downloads

190

Version

2.0.0

License

MIT

Unpacked Size

7.05 kB

Total Files

4

Last publish

Collaborators

  • avatar
  • avatar