vite-plugin-tdoc (version 2.0.4) is a Vite plugin that transforms Markdown files into anything (e.g., HTML, Vue components) during the build process. Inspired by VitePress, it provides hooks for custom Markdown processing using markdown-it and its ecosystem (containers, attributes, anchors, TOC). It supports before/render/after transforms and can integrate additional Vite plugins. Released under MIT license. The plugin is actively maintained, with a focus on flexibility and developer control over Markdown transformation.
npm install vite-plugin-tdocVerified import paths — ran on the pinned version, not inferred.
Shows basic Vite config with vitePluginTdoc, enabling line numbers, anchor links, custom markdown-it plugins, and a before transform to strip HTML comments.
Use dynamic import() instead of require() in config, or mark package as type: module.
Ensure custom container syntax does not interfere with attribute syntax; test combinations.
Check release notes for migration to direct markdown-it plugin usage.
Use ES module syntax (export default) in vite config.
Always return a string from transform hooks or undefined to skip modification.
Switch vite.config to ES module (type: 'module' in package.json) and use import syntax.
Install the optional dependencies: npm install markdown-it-container markdown-it-attrs markdown-it-anchor markdown-it-toc-done-right
Use the config callback correctly: config(md) { md.use(require('markdown-it-emoji')) }