Klenodexample

Plugin Reference

MarkdownPlugin

MarkdownPlugin compiles Markdown files and Haml markdown filters into component-shaped Ruby output.

Markdown Files

.md files become Ruby component modules. The plugin parses Markdown with kramdown using the GFM parser and emits factory calls instead of raw HTML strings.

Guide = import("./guide.md")

The imported value is the default exported component class, so consuming code can render it like any other component.

Frontmatter

Markdown files can start with YAML frontmatter. The frontmatter is removed from the rendered body and exposed on the component class as Frontmatter.

---
title: Hello
date: 2026-07-25
---

# Hello
Article = import("./article.md")
Article::Frontmatter.fetch(:title)

Component Map

If /markdown-components.rb exists, Markdown rendering uses its Default hash to map tags to components. This is similar in spirit to MDX component maps, but it stays in Ruby.

Paragraph = import("/components/markdown/Paragraph.haml")

Default = {
  p: Paragraph
}

Raw HTML nodes and Markdown nodes both go through the factory, so applications can keep styling scoped to small components.

Haml Filters

Haml :markdown filters use the same Markdown compiler and component map as imported Markdown files. Updating the component map reloads affected Markdown modules and Haml modules that use Markdown filters.