@davaux/markdown
v0.9.0
Published
Markdown route plugin for Davaux — adds .page.md support
Readme
@davaux/markdown
Markdown route plugin for Davaux — adds .page.md support.
Installation
npm install @davaux/markdownSetup
// davaux.config.ts
import { defineConfig } from 'davaux/config'
import { markdown } from '@davaux/markdown'
export default defineConfig({
plugins: [markdown()],
})Route files
Any file matching *.page.md in src/routes/ is treated as a page. YAML frontmatter sets the <title>, meta description, and any other head meta:
---
title: About Us
description: Learn about our team
author: Jane Smith
---
# About Us
Welcome to our team page.Frontmatter keys title and description map directly to ctx.head.title and ctx.head.description. All other keys become ctx.head.meta entries.
Options
| Option | Type | Default | Description |
|---|---|---|---|
| articleClass | string | 'prose' | CSS class applied to the wrapping <article> element |
| markedExtensions | MarkedExtension[] | [] | Additional marked extensions |
renderMarkdown(content, options?)
Render a markdown string to HTML at runtime using the same marked pipeline as .page.md route files:
import { renderMarkdown } from '@davaux/markdown'
const html = await renderMarkdown('# Hello world', { articleClass: 'prose' })