Appearance
Troubleshooting
If something breaks, here are common fixes:
- If you get
window is not definedduring SSR, wrap components in<client-only>for Nuxt and use theonMountedguard for Vite SSR. - Install
katexwhen math rendering fails, and importkatex/dist/katex.min.cssin your app entry. - For Mermaid issues, upgrade or pin
mermaidto a version >= 11 and check asynchronous render logs. - For performance concerns, check that
viewportPriorityis true and avoid too many heavy nodes in a single mount.
If unsure, reproduce issue using the playground (or the hosted quick test) and then open an issue with stack trace and minimal markdown sample.
Hosted quick test: https://vue-markdown-renderer.netlify.app/test
Open a new issue (quick link): https://github.com/Simon-He95/vue-markdown-renderer/issues/new?template=bug_report.yml
Common problems (FAQ)
Tailwind / CSS utilities overriding styling: If your project uses Tailwind or a component library (e.g., shadcn), utility classes or global styles may override the library's styles. See the Tailwind integration guide for recommended import ordering and strategies:
/guide/tailwind.Quick fixes:
- Import
vue-renderer-markdown/index.cssinside a@layer components { ... }block (see the Tailwind page). This controls style ordering. - Consider setting a
prefixin Tailwind config (e.g.,tw-) to avoid collisions with component library class names. - Use scoped selectors or
:deepto target only the elements you need to override.
- Import
Want to tweak looks? You can customize via CSS variables in
src/index.css(e.g.,--vscode-editor-background,--vscode-editor-foreground) or override component classes in your app's stylesheet. Use the@applyhelper or your own stylesheet to keep style rules isolated.Slots first: if the styling you want needs layout changes inside a component, check whether the component provides a named slot (e.g.,
header-left,header-right,loading). Slots are an easy and stable escape hatch that let you re-render interior markup without overriding internals.Still not enough? Use
setCustomComponents(id, mapping)to replace an entire renderer for a node with your own Vue component. See theAdvancedguide forsetCustomComponentsusage and how to scope them to acustom-id. Quick example (replace the renderer forcode_blocknodes scoped tomy-docs):
ts
import { setCustomComponents } from 'vue-renderer-markdown'
setCustomComponents('my-docs', {
code_block: MyCustomCodeBlock,
})This will cause all MarkdownRender instances with custom-id="my-docs" to render the code_block node using MyCustomCodeBlock instead of the default. See Advanced for more examples.
Repro / report flow: When you run into rendering anomalies or errors, try to reproduce them with the
playgroundapp and a minimal markdown sample. If it's still broken, run unit tests locally withpnpm testto rule out regressions. Then open an issue with:- Minimal markdown example that reproduces the problem (include in the issue body or link to a gist).
- Steps to reproduce (playground link or
playgroundinstructions), and the environment (browser, Node version, Vite/Nuxt). - Any error stack traces and relevant console output.
Prefer to share a small
playgroundreproduction and include a link; maintainers will triage and ask for more context if needed.Extra tip: if you can write a unit/integration test that reproduces the bug, add it under the
test/folder and runpnpm testlocally — this is the fastest way for maintainers to validate and fix regressions.