logo

Custom Renderers

Examples / Custom Renderers

Custom Renderers

Toggle between default and filtered rendering to see how allowRenderersOnly controls which markdown features are active.

All Renderers Active

Every markdown feature is rendered: headings, paragraphs, links, code blocks, tables, blockquotes, horizontal rules, and lists.

Custom Renderers Demo

How It Works

Svelte Markdown lets you control which renderers are active. This is useful for:

  1. Restricting markdown features in user-generated content
  2. Creating simplified markdown views
  3. Building focused content editors

Code Example

Use allowRenderersOnly to whitelist specific renderers:

import { allowRenderersOnly } from '@humanspeak/svelte-markdown'

const renderers = allowRenderersOnly([
    'paragraph', 'heading', 'text',
    'strong', 'em', 'link'
])

Check out the documentation for more details.


Tip: Disabled renderers simply won't render their content, keeping your output clean and predictable.

Here is a table for reference:

RendererDescription
paragraphBasic text blocks
headingh1-h6 elements
linkAnchor tags
codespanInline code
codeCode blocks
  • Item one
  • Item two
  • Item three