← Back to all Posts

Markdown & components guide

2 min read

This demo post collects everything you can write in the site's content: standard Markdown rendered with Comark plus interactive Svelte components.

Text and emphasis

You can use bold, italic, strikethrough and inline code. Links point to sites like Astro and open normally.

Block quotes are handy to highlight an idea or a reference. They can span several lines.

Lists

Unordered list:

  • First item
  • Second item

    • Nested
  • Third item

Ordered list:

  1. Define the collection in src/config/collections.json
  2. Create the content in src/content/
  3. The build generates the routes automatically

Table

PieceFileEdit in the CMS
Sitesrc/config/site.jsonSite settings → Site
Languagessrc/config/i18n.jsonSite settings → Languages
UI textssrc/config/ui.jsonSite settings → UI texts

Code

import { parse } from 'comark'
import highlight from 'comark/plugins/highlight'

const tree = await parse('# Hello **world**', { plugins: [highlight()] })
console.log(tree.nodes)

Images

Images are optimized at build time automatically:

Sveltia CMS screenshot

Alert component

The Alert Svelte component is invoked with Comark's directive syntax and supports four variants:

Contenido