{"id":22734,"library":"vite-plugin-md-to-html","title":"vite-plugin-md-to-html","description":"Vite plugin to convert Markdown files to HTML strings at build time, with front-matter extraction, optional syntax highlighting via highlight.js, and relative image path resolution. Version 0.0.18 is the latest stable release, with monthly updates. Differentiators: zero-config setup for plain HTML output (no framework coupling), built-in image resolution for Vite asset handling, and optional build-time syntax highlighting. Targets developers using Vite who want to import .md files as HTML strings without a frontend framework.","status":"active","version":"0.0.18","language":"javascript","source_language":"en","source_url":"https://github.com/saurabhdaware/vite-plugin-md-to-html","tags":["javascript","vite","vite-plugin","markdown","vite-markdown-it","markdown-to-html","vite-plugin-markdown-to-html","typescript"],"install":[{"cmd":"npm install vite-plugin-md-to-html","lang":"bash","label":"npm"},{"cmd":"yarn add vite-plugin-md-to-html","lang":"bash","label":"yarn"},{"cmd":"pnpm add vite-plugin-md-to-html","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency; plugin only works with Vite","package":"vite","optional":false},{"reason":"core markdown parser used internally","package":"markdown-it","optional":false},{"reason":"used for syntax highlighting when option enabled","package":"highlight.js","optional":true}],"imports":[{"note":"Named export, not default. TypeScript types are included.","wrong":"import vitePluginMdToHTML from 'vite-plugin-md-to-html'","symbol":"vitePluginMdToHTML","correct":"import { vitePluginMdToHTML } from 'vite-plugin-md-to-html'"},{"note":"attributes is a named export from the compiled markdown module. Default export is the HTML string.","wrong":"import attributes from './test.md'","symbol":"attributes","correct":"import { attributes } from './test.md'"},{"note":"TypeScript only; available since v0.0.14.","symbol":"PluginOptions","correct":"import type { PluginOptions } from 'vite-plugin-md-to-html'"}],"quickstart":{"code":"// vite.config.ts\nimport { defineConfig } from 'vite';\nimport { vitePluginMdToHTML } from 'vite-plugin-md-to-html';\n\nexport default defineConfig({\n  plugins: [\n    vitePluginMdToHTML({\n      resolveImageLinks: true,\n      syntaxHighlighting: true\n    })\n  ]\n});\n\n// src/main.ts\nimport html, { attributes } from './test.md';\n\ndocument.title = attributes.title ?? '';\ndocument.querySelector('#app')!.innerHTML = html;\n\ntype Frontmatter = {\n  title?: string;\n  // ... other fields\n};","lang":"typescript","description":"Shows Vite plugin setup with image resolution and syntax highlighting, plus importing .md to get HTML string and frontmatter attributes."},"warnings":[{"fix":"Upgrade to v0.0.14 or later for SSR/SSG support.","message":"In versions before v0.0.14, image path resolution only worked in CSR, not SSR/SSG.","severity":"breaking","affected_versions":"<0.0.14"},{"fix":"Use the 'markdownIt' option and ensure you have the correct type definitions.","message":"The option 'markdownIt' is passed through to markdown-it but is not officially typed in PluginOptions until later versions.","severity":"deprecated","affected_versions":"<0.0.11"},{"fix":"Set resolveImageLinks: true in plugin options.","message":"Images in markdown are not resolved by default; you must enable 'resolveImageLinks' option.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"import 'highlight.js/styles/github.css';","message":"Syntax highlighting CSS is not included; you must import a highlight.js stylesheet separately.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Add `/// <reference types='vite-plugin-md-to-html/types' />` to a global.d.ts file.","cause":"TypeScript cannot resolve .md imports without a type declaration.","error":"Cannot find module './test.md' or its corresponding type declarations."},{"fix":"Ensure the plugin is added to the vite.config.js/ts plugins array.","cause":"Vite fails to parse .md file if the plugin is not properly configured in config.","error":"[vite] Internal server error: Failed to parse source for import analysis because the content contains invalid JS syntax."},{"fix":"Run `npm install --save-dev vite-plugin-md-to-html` and verify import path.","cause":"The package is not installed or not imported correctly.","error":"Uncaught TypeError: Failed to resolve module specifier 'vite-plugin-md-to-html'. Relative references must start with either '/', './', or '../'."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}