[go: up one dir, main page]

@mdit-vue/plugin-title
TypeScript icon, indicating that this package has built-in type declarations

2.1.3 • Public • Published

@mdit-vue/plugin-title

npm license

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-vue/plugin-title

Usage

import { titlePlugin } from '@mdit-vue/plugin-title';
import type { MarkdownItEnv } from '@mdit-vue/types';
import MarkdownIt from 'markdown-it';

const md = MarkdownIt({ html: true }).use(titlePlugin);
const env: MarkdownItEnv = {};

const rendered = md.render(
  `\
# h1
## h2
### h3
`,
  env,
);

console.log(env.title);

Package Sidebar

Install

npm i @mdit-vue/plugin-title

Weekly Downloads

20,559

Version

2.1.3

License

MIT

Unpacked Size

5.86 kB

Total Files

9

Last publish

Collaborators

  • meteorlxy