Skill

Integrate Markstream markdown rendering in Svelte 5 apps

Integrates Markstream's beta streaming markdown renderer into Svelte 5/SvelteKit using runes and safe client boundaries.

Works with sveltesveltekitkatexmermaid

84
Spark score
out of 100
Updated 3 days ago
Version 15.3.0

Add to Favorites

Why it matters

Integrate streaming markdown rendering into Svelte 5 and SvelteKit applications with proper SSR boundaries, typewriter effects, and support for math and diagrams.

Outcomes

What it gets done

01

Configure Markstream component with streaming state and typewriter effects for live chat interfaces

02

Set up browser-safe worker boundaries for KaTeX math and Mermaid diagram rendering

03

Install and import package CSS with proper ordering after resets and KaTeX stylesheets

04

Validate SSR compatibility using svelte-check and build processes for production deployment

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/ag-markstream-svelte | bash

Overview

Markstream Svelte

Integrates Markstream's beta streaming markdown renderer into Svelte 5/SvelteKit using runes-based props, scoping workers to client boundaries with safe HTML/Mermaid defaults. Use for Svelte 5 or SvelteKit apps adding Markstream streaming markdown; Svelte 4 is not supported.

What it does

This skill integrates Markstream using Svelte 5 runes and SvelteKit-safe browser boundaries. Its workflow: before changing dependencies or source files, inspect the existing package manager and project conventions, preview the intended edits, and obtain explicit user approval; confirm Svelte 5 and acceptance of a beta package; install only the specifically requested peers, importing the package CSS after resets and KaTeX CSS only for math; start with <MarkdownRender {content} /> and smooth streaming set to auto; for live chat disable fade and opt into the cursor, then on completion set final, disable pacing/cursor, and enable fade only if desired; use nodes only for worker-owned parsing or shared AST state; use $props() and callbacks, configuring KaTeX or Mermaid workers only when requested; prefer renderer-local customComponents, using scoped registration only when sharing is intentional; and keep browser-only workers behind SvelteKit client boundaries, validating with svelte-check, a build, or an end-to-end test.

Documented limitations: Svelte 4 is unsupported and the package is beta, workers and heavy peers require client-side bundler support, and the skill does not migrate unrelated Svelte architecture. A security note: keep safe HTML and strict Mermaid defaults, review dependencies, and never run browser-only peers during SSR.

When to use - and when NOT to

Use for Svelte 5 or SvelteKit package setup, streaming state, workers, or scoped custom components. Svelte 4 is explicitly unsupported.

Inputs and outputs

Input is an existing Svelte 5 or SvelteKit application. Output is a working MarkdownRender integration using runes-based props, with worker/heavy peers scoped to SvelteKit client boundaries and HTML/Mermaid trust kept at safe defaults.

<script lang="ts">
  import MarkdownRender from 'markstream-svelte'
  import 'markstream-svelte/index.css'

  let { content, isDone }: { content: string; isDone: boolean } = $props()
</script>

<MarkdownRender
  {content}
  final={isDone}
  fade={isDone}
  typewriter={!isDone}
  smoothStreaming={isDone ? false : 'auto'}
  htmlPolicy="safe"
/>

Who it's for

Svelte 5 or SvelteKit developers integrating Markstream's beta streaming markdown renderer who need runes-based bindings and correctly scoped browser-only dependencies.

Source README

Markstream Svelte

Overview

Integrate Markstream using Svelte 5 runes and SvelteKit-safe browser boundaries.

When to Use

Use for Svelte 5 or SvelteKit package setup, streaming state, workers, or scoped custom components. Svelte 4 is unsupported.

Workflow

Before changing dependencies or source files, inspect the existing package manager and project conventions, preview the intended edits, and obtain explicit user approval.

  1. Confirm Svelte 5 and acceptance of a beta package.
  2. Install only requested peers; import package CSS after resets and KaTeX CSS only for math.
  3. Start with <MarkdownRender {content} /> and smooth streaming auto.
  4. For live chat disable fade and opt into the cursor; on completion set final, disable pacing/cursor, and enable fade only if desired.
  5. Use nodes only for worker-owned parsing or shared AST state.
  6. Use $props() and callbacks. Configure KaTeX or Mermaid workers only when requested.
  7. Prefer renderer-local customComponents; use scoped registration only when sharing is intentional.
  8. Keep browser-only workers behind SvelteKit client boundaries; validate with svelte-check, build, or e2e.

Example

<script lang="ts">
  import MarkdownRender from 'markstream-svelte'
  import 'markstream-svelte/index.css'

  let { content, isDone }: { content: string; isDone: boolean } = $props()
</script>

<MarkdownRender
  {content}
  final={isDone}
  fade={isDone}
  typewriter={!isDone}
  smoothStreaming={isDone ? false : 'auto'}
  htmlPolicy="safe"
/>

Limitations

  • Svelte 4 is unsupported and the package is beta.
  • Workers and heavy peers require client-side bundler support.
  • This skill does not migrate unrelated Svelte architecture.

Security & Safety Notes

Keep safe HTML and strict Mermaid defaults. Review dependencies and never run browser-only peers during SSR.

Discussion

Questions & comments ยท 0

Sign In Sign in to leave a comment.