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. - If you load KaTeX/Mermaid via CDN
<script>, make surewindow.katex/window.mermaidexist before first render, or callsetKatexLoader(() => window.katex)/setMermaidLoader(() => window.mermaid)once after they load. - 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://markstream-vue.simonhe.me/test
Open a new issue (quick link): https://github.com/Simon-He95/markstream-vue/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
markstream-vue/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.
Note:
markstream-vuescopes its packaged CSS under an internal.markstream-vuecontainer (including theme variables and Tailwind utilities), so most conflicts come from ordering/resets inside the renderer area rather than global leakage.- 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):
import { setCustomComponents } from 'markstream-vue'
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.
CSS looks wrong? Start here
Most rendering bugs are caused by style ordering, missing resets, or utility frameworks (Tailwind/UnoCSS) trumping component CSS. Run through this checklist before filing an issue:
- Reset browser defaults — margins on
p,dl,table, andprediffer per browser. Import a reset (modern-css-reset,@unocss/reset, or Tailwind's@tailwind base) beforemarkstream-vuestyles:
@import 'modern-css-reset';
@tailwind base;
@tailwind components;
@import 'markstream-vue/index.css';- Use CSS layers — When Tailwind or UnoCSS runs in
@layer componentsorutilities, wrap the library CSS import so the cascade is predictable:
@layer components {
@import 'markstream-vue/index.css';
}For UnoCSS, inject the CSS inside preflights:
import { defineConfig, presetUno } from 'unocss'
export default defineConfig({
presets: [presetUno()],
preflights: [
{
layer: 'components',
getCSS: () => '@import "markstream-vue/index.css";',
},
],
})Double-check peer CSS — Monaco, KaTeX, and Mermaid each ship CSS. Missing imports show up as invisible editors or unstyled formulas. Confirm the component guide you are following calls out the extra stylesheet.
Scope overrides via
custom-id— When integrating with larger design systems, renderers can stomp on each other. Addcustom-id="docs"toMarkdownRenderand apply overrides scoped to[data-custom-id="docs"]so other layouts stay untouched.
If none of the above helps, reproduce the issue in the playground (pnpm play) with a CSS-only snippet and include the link when reporting the bug.
Quick test — run the playground locally to reproduce and debug:
pnpm play
# open the playground and reproduce the issue with a minimal Markdown sample