mirror of
https://kevinblog.sytes.net/Code/Jibo-Revival-Group/JiboViteDocs.git
synced 2026-06-17 20:16:15 +00:00
Initalize
This commit is contained in:
27
node_modules/@lando/vitepress-theme-default-plus/markdown/tabs-override-plugin.js
generated
vendored
Normal file
27
node_modules/@lando/vitepress-theme-default-plus/markdown/tabs-override-plugin.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
import container from 'markdown-it-container';
|
||||
import Debug from 'debug';
|
||||
|
||||
const parseTabsParams = input => {
|
||||
const match = input.match(/key:(\S+)/);
|
||||
return {shareStateKey: match?.[1]};
|
||||
};
|
||||
|
||||
export default function(md, {debug = Debug('@lando/markdown-plugin')}) { // eslint-disable-line
|
||||
md.use(container, 'tabs', {
|
||||
render(tokens, index, _options, env) {
|
||||
const token = tokens[index];
|
||||
const style = token.info.trim().slice(4).trim();
|
||||
|
||||
if (token.nesting === 1) {
|
||||
const params = parseTabsParams(token.info);
|
||||
const shareStateKeyProp = params.shareStateKey
|
||||
? `sharedStateKey="${md.utils.escapeHtml(params.shareStateKey)}"`
|
||||
: '';
|
||||
return `<PluginTabs class="${style}" ${shareStateKeyProp}>\n`;
|
||||
} else {
|
||||
return `</PluginTabs>\n`;
|
||||
}
|
||||
},
|
||||
});
|
||||
debug('override custom markdown container %o with styling support', 'vitepress-plugin-tabs');
|
||||
};
|
||||
Reference in New Issue
Block a user