underdot-md
v2.0.2
Published
Markdown for Underdot
Readme
underdot-md
Renders .md pages for Underdot, and gives templates a helper that renders a string of Markdown.
Install
npm install underdot-mdimport type { Configuration } from 'underdot';
import { markdown } from 'underdot-md';
export default {
plugins: [markdown()],
} satisfies Configuration;Rendering
A page's body renders as GitHub Flavored Markdown, as marked renders it with its defaults:
- Tables, strikethrough, and bare-URL autolinks render.
- Raw HTML passes through as written.
- Link and image targets are written as given.
A body reads no variable, so a page that needs one is written in another engine. A Markdown page renders inside a template written in another engine, such as EJS. A Markdown file whose name starts with an underscore is a template, and rendering one is an error.
The helper
markdown(text) returns the text rendered as HTML, as a page's body renders. A text that is not a string is an error, so a template checks for a missing variable before calling it.
<%- markdown(summary) %>Options
The plugin takes no options.
q-docs/specs/markdown.md holds every rule the plugin commits to.
