
Product
Introducing Socket Fix for Safe, Automated Dependency Upgrades
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
@mdit-vue/plugin-headers
Advanced tools
A markdown-it plugin to get markdown headers.
env.headers
.npm i @mdit-vue/plugin-headers
import { headersPlugin } from '@mdit-vue/plugin-headers';
import type { MarkdownItEnv } from '@mdit-vue/types';
import MarkdownIt from 'markdown-it';
const md = MarkdownIt({ html: true }).use(headersPlugin, {
// options
});
const env: MarkdownItEnv = {};
const rendered = md.render(
`\
# h1
## h2
### h3
`,
env,
);
console.log(env.headers);
Type: (str: string) => string
Details:
A function for formatting header title.
Type: number[]
Default: [2, 3]
Details:
Heading level that going to be extracted.
When using this plugin with markdown-it-anchor (recommended), this option should be a subset of markdown-it-anchor's level
option to ensure the header slugs are existed.
Type: boolean
Default: false
Details:
Should allow headers inside nested blocks or not.
If set to true
, headers inside blockquote, list, etc. would also be extracted.
Type: (str: string) => string
Default: slugify
from @mdit-vue/shared
Details:
A custom slugification function.
The default slugify function comes from @mdit-vue/shared package.
When using this plugin with markdown-it-anchor (recommended), this option will be ignored because the id
of the headings have already been determined by markdown-it-anchor's slugify
option.
FAQs
A markdown-it plugin to get markdown headers
The npm package @mdit-vue/plugin-headers receives a total of 28,595 weekly downloads. As such, @mdit-vue/plugin-headers popularity was classified as popular.
We found that @mdit-vue/plugin-headers demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
Security News
CISA denies CVE funding issues amid backlash over a new CVE foundation formed by board members, raising concerns about transparency and program governance.
Product
We’re excited to announce a powerful new capability in Socket: historical data and enhanced analytics.