humanonlyweb/writer

Content

Markdown, rendered with your components.

Markdown

<WriterContent> renders Markdown, or a document parsed ahead of time. In plain Vue, import WriterContent.

Examples

Live preview

Markdown renders as you type; debounce waits a beat before parsing again.

Rendered

Type on the left: Markdown renders on the right, blocks included.

Copy code

Props

PropTypeDescription
valuestring | MarkdownDocumentMarkdown, or a document parsed ahead of time (no parser download).
componentsRecord<string, Component>Native element overrides for this render, e.g. { a: NuxtLink }.
debouncenumberMs to wait before parsing changed Markdown again. ~100 for previews.
tagstringWrapper element. Default div.

Give it a parsed document on public pages: they render without loading the parser. A string works anywhere, server rendering included, and loads the parser on demand.

What renders

  • Markdown's own elements, and registered blocks. Anything else renders its content only.

  • Images load lazily. An image alone in its paragraph, with a title, becomes a <figure>. See Images.

  • Content is sanitized again before rendering. See Security.

Your own wrapper

renderDocument(document, { blocks, components }) returns the rendered Vue nodes, for when <WriterContent> doesn't fit. These docs render their pages with it.