@mdit-kdu/plugin-title
v1.0.0
Published
A markdown-it plugin to get markdown page title
Downloads
2
Maintainers
Readme
@mdit-vkduue/plugin-title
A markdown-it plugin to get page title.
- Extracts title (the content of the first level-1 heading) into markdown-it
env.title
.
Install
npm i @mdit-kdu/plugin-title
Usage
import MarkdownIt from 'markdown-it';
import { titlePlugin } from '@mdit-kdu/plugin-title';
import type { MarkdownItEnv } from '@mdit-kdu/types';
const md = MarkdownIt({ html: true }).use(titlePlugin);
const env: MarkdownItEnv = {};
const rendered = md.render(
`\
# h1
## h2
### h3
`,
env,
);
console.log(env.title);