English
markdown-hint
Add gfm alerts and hint containers to your VuePress site.
This plugin has been integrated into the default theme.
Usage
npm i -D @vuepress/plugin-markdown-hint@nextimport { markdownHintPlugin } from '@vuepress/plugin-markdown-hint'
export default {
plugins: [
markdownHintPlugin({
// Enable hint container, true by default
hint: true,
// Enable gfm alert
alert: true,
}),
],
}Guide
By default, we support important, info, note, tip, warning, caution, details containers with markdown container:
Demo
::: tip
A custom tip container with `code` and [links](https://example.com).
```js
const a = 1
```
:::To customize the title of the container, you can add the title after the named container:
Custom Title
An important container with customized title.
Demo
::: important Custom Title
An important container with customized title.
:::The container can contain a title only:
Title only
Demo
::: warning Title only
:::To render a container without a title, add the {no-title} marker at the end of the container info string. The marker is removed and the title is omitted:
An untitled tip container.
Demo
::: tip {no-title}
An untitled tip container.
:::{no-title} is ignored by the details container, which always needs a summary.
The plugin also provides an alert option to support gfm alerts:
> [!note]
> This is note text
> [!important]
> This is important text
> [!tip]
> This is tip text
> [!warning]
> This is warning text
> [!caution]
> This is caution textOptions
hint
booleanDefault
trueWhether to enable hint containers including important, info, note, tip, warning, caution, details.
alert
booleanWhether to enable GFM alert support.
injectStyles
booleanDefault
trueWhether to inject default styles.
locales
MarkdownHintPluginLocaleConfigLocale config for hint container titles.
See also: Locales.
locales.<localePath>.important
stringDefault title text for important block.
locales.<localePath>.note
stringDefault title text for note block.
locales.<localePath>.tip
stringDefault title text for tip block.
locales.<localePath>.warning
stringDefault title text for warning block.
locales.<localePath>.caution
stringDefault title text for caution block.
locales.<localePath>.info
stringDefault title text for info block.
locales.<localePath>.details
stringDefault title text for details block.
Styles
You can customize the style via CSS variables:
:root {
--hint-font-size: 0.92rem;
/* container box */
--hint-container-margin: 0.75rem;
--hint-container-padding: 0.25em 1em;
--hint-container-radius: 0.5em;
--hint-container-no-title-padding: 0.5em;
--hint-title-margin: 0.75em;
/* details box */
--hint-details-margin: 0.75rem;
--hint-details-padding: 1.25rem 1rem;
--hint-details-radius: 0.5rem;
/* important */
--important-c-accent: var(--vp-c-purple-bg);
--important-c-text: var(--vp-c-purple-text);
--important-c-soft: var(--vp-c-purple-soft);
/* info */
--info-c-accent: var(--vp-c-blue-bg);
--info-c-text: var(--vp-c-blue-text);
--info-c-soft: var(--vp-c-blue-soft);
/* note */
--note-c-accent: var(--vp-c-grey-bg);
--note-c-text: var(--vp-c-grey-text);
--note-c-soft: var(--vp-c-grey-soft);
/* tip */
--tip-c-accent: var(--vp-c-green-bg);
--tip-c-text: var(--vp-c-green-text);
--tip-c-soft: var(--vp-c-green-soft);
/* warning */
--warning-c-accent: var(--vp-c-yellow-bg);
--warning-c-text: var(--vp-c-yellow-text);
--warning-c-soft: var(--vp-c-yellow-soft);
/* caution */
--caution-c-accent: var(--vp-c-red-bg);
--caution-c-text: var(--vp-c-red-text);
--caution-c-soft: var(--vp-c-red-soft);
/* detail */
--detail-c-bg: var(--vp-c-control);
--detail-c-icon: var(--vp-c-border);
--detail-c-soft: var(--vp-c-grey-soft);
}The details container uses the --detail-c-* variables, and danger is rendered as a caution container.
