Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including remark-heading-gap with all npm packages installed. Try it out:

var remarkHeadingGap = require("remark-heading-gap")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

remark-heading-gap v3.1.0

Adjust the gap between headings.


Build Coverage Downloads Chat Sponsors Backers

heading-gap support, without needing spaces, for remark.



npm install remark-heading-gap


Say we have a markdown file,, that looks as follows:

# remark-heading-gap

## Example

## API

### `remark.use(headingGap[, options])`

## Contributing

And our script, example.js, contains:

const fs = require('fs')
const remark = require('remark')
const gap = require('remark-heading-gap')

const result = remark()


Now, running node example yields:

# remark-heading-gap

## Example

## API

### `remark.use(headingGap[, options])`

## Contributing


remark.use(headingGap[, options])

remark-heading-gap ensures that automatically generated Markdown follows your own rules for newlines in between section headings. From personal experience, adding extra newlines helps to visualise breaks in sections, especially when quickly scanning documentation.

options.{1, 2, 3, 4, 5, 6}

Pass a gap (Object, default: {before: '\n', after: ''} for options.2, {before: '', after: ''} for all others) Customise the gap that appears for up to 6 levels of heading; for example, pass {1: {before: '\n', after: '\n'}} to double the gap for the first heading. Note that both before and after accept a custom string so you can specify \r\n instead if you choose; or add other presentational markers.


See in remarkjs/remark for ways to get started.

This organisation has a Code of Conduct. By interacting with this repository, organisation, or community you agree to abide by its terms.


MIT © Ben Briggs


RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free