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
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-headingsUse
Say we have the following file, example.md:
# Title
# Description
## Usage
### Example
## API
# RelatedAnd 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
## RelatedAPI
remark().use(normalizeHeadings)
Make sure that there is only one top-level heading in a document by adjusting heading depths accordingly.
Related
mdast-normalize-headings— mdast utility that is in the core of this plugin
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