Skip to content

mdast plugin to check and inject the title of a markdown as the first element.

License

Notifications You must be signed in to change notification settings

RichardLitt/remark-title

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

remark-title

remark plugin to check and inject the title of a markdown as the first element.

Usage

NPM

Used as a plugin for remark like so:

const title = require('remark-title')
const remark  = require('remark')

readme = remark()
  .use(title, {title: 'remark-title'})
  .processSync(readme)

This will add a title to your document if one is not already present. The title will be the name of the folder (VFile#dirname, when available, or process.cwd()), unless specified as an option. If an existing title is different (case-insensitive), it will replace it.

For example, the following input markdown:

# Bogus Title

Hello World!

Would yield:

# remark-title

Hello World!

options.title

Optional. A string for a specified title.

License

MIT. See LICENSE.md for details.

About

mdast plugin to check and inject the title of a markdown as the first element.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published