JSPM

remark-normalize-headings

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 10932
  • Score
    100M100P100Q149710F
  • License MIT

remark plugin to make sure there is no more than a single top-level heading in a document

Package Exports

  • remark-normalize-headings

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (remark-normalize-headings) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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.

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, organisation, or community you agree to abide by its terms.

License

MIT © Eugene Sharygin