// markdown-it plugin for wrapping
.... // // If your plugin was chained before preWrapper, you can add additional element directly. // If your plugin was chained after preWrapper, you can use these slots: // 1. // 2. // 3. // 4. import type MarkdownIt from 'markdown-it'; import type { MarkdownParsedData } from '../markdown'; export const preWrapperPlugin = (md: MarkdownIt) => { const fence = md.renderer.rules.fence!; md.renderer.rules.fence = (...args) => { const [tokens, idx] = args; const token = tokens[idx]; const data = (md as any).__data as MarkdownParsedData; if (token.info?.trim() === 'vue') { data.vueCode = token.content; } const rawCode = fence(...args).replace( /
${rawCode}`; }; };