mirror of
https://kevinblog.sytes.net/Code/Jibo-Revival-Group/JiboViteDocs.git
synced 2026-06-16 19:56:33 +00:00
Initalize
This commit is contained in:
24
node_modules/@lando/vitepress-theme-default-plus/utils/create-container.js
generated
vendored
Normal file
24
node_modules/@lando/vitepress-theme-default-plus/utils/create-container.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
import container from 'markdown-it-container';
|
||||
|
||||
export default function(name, opts = {}, md) {
|
||||
return [container, name, {
|
||||
render(tokens, index, _options, env) {
|
||||
const token = tokens[index];
|
||||
const info = token.info.trim().slice(name.length).trim() || opts.defaultTitle;
|
||||
const attrs = md.renderer.renderAttrs(token);
|
||||
|
||||
// opening tag
|
||||
if (token.nesting === 1) {
|
||||
const title = info ? md.renderInline(info, {references: env.references}) : undefined;
|
||||
const titleMarkdown = title ? `<p class="custom-block-title">${title ? title : ''}</p>` : '';
|
||||
|
||||
// special handling for details
|
||||
if (name === 'details') return `<details class="${name} custom-block"${attrs}><summary>${title}</summary>\n`;
|
||||
// otherwise
|
||||
return `<div class="${name} custom-block"${attrs}>${titleMarkdown}\n`;
|
||||
|
||||
// closing tag
|
||||
} else return name === 'details' ? `</details>\n` : `</div>\n`;
|
||||
}},
|
||||
];
|
||||
};
|
||||
Reference in New Issue
Block a user