import { getLangs } from '../shared' import type MarkdownIt from 'markdown-it' export function preWrapperPlugin(md: MarkdownIt) { const fence = md.renderer.rules.fence! md.renderer.rules.fence = (...args) => { const [tokens, idx] = args const token = tokens[idx] // remove title from info token.info = token.info.replace(/\[.*\]/, '') let lang = extractLang(token.info) const allLangs = getLangs() if (!allLangs.includes(lang)) { lang = 'plainText' } const rawCode = fence(...args) return `