remark plugin to check and inject the title of a markdown as the first element.
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!
Optional. A string for a specified title.
MIT. See LICENSE.md for details.