s-m-r-t

Markdown

Render markdown content with XSS protection. Supports headings, bold, italic, and lists.

Installation

typescript
import { Markdown } from '@happyvertical/smrt-svelte';

Basic Usage

Render markdown content with automatic styling.

Welcome to SMRT

This is a paragraph with emphasis and strong text.

Features

  • Simple API
  • Type safety
  • Great documentation
svelte
<Markdown content={markdownText} />

Headings

Support for H1, H2, and H3 headings.

Heading 1

Heading 2

Heading 3

svelte
<Markdown content={`# Heading 1
## Heading 2
### Heading 3`} />

Text Formatting

Bold and italic text formatting.

This text has bold words and italic words.

You can also combine bold and nested italic text.

svelte
<Markdown content="**bold** and *italic*" />

Lists

Unordered list support.

  • First item
  • Second item
  • Third item with more detail
svelte
<Markdown content={`- First item
- Second item
- Third item`} />

Security

The Markdown component automatically escapes HTML to prevent XSS attacks. User-provided content is safe to render.

<script>alert('xss')</script> - This is escaped and safe!
svelte
<Markdown content="<script>alert('xss')</script>" />

Props

PropTypeDefaultDescription
content *string-Markdown content to render

TypeScript

typescript
import { Markdown } from '@happyvertical/smrt-svelte';

interface Props {
  content: string;
}

Supported Syntax

SyntaxOutput
# Heading 1H1 heading
## Heading 2H2 heading
### Heading 3H3 heading
**bold**Bold text
*italic*Italic text
- itemList item