Skip to main content

Module markdown_ext

Module markdown_ext 

Source
Expand description

GitHub Flavored Markdown (GFM) extensions: tables, strikethrough, task lists. GitHub Flavored Markdown (GFM) extensions plugin.

Pre-processes Markdown content in the before_compile phase to add support for GFM features that the upstream renderer does not handle:

  • Tables| col | col | blocks with a |---|---| separator row.
  • Strikethrough~~text~~ becomes <del>text</del>.
  • Task lists- [ ] item and - [x] done become checkbox lists.
  • Footnotes[^id] references with [^id]: definitions.

§How it works

For each .md file under content_dir, the plugin:

  1. Splits the YAML/TOML frontmatter from the body so it stays untouched.
  2. Walks the body line-by-line, tracking fenced code blocks so GFM syntax inside blocks is preserved literally.
  3. Detects GFM-specific blocks (tables, task lists) and renders only those blocks through pulldown-cmark with the matching options enabled, substituting the rendered HTML back into the source.
  4. Applies an inline strikethrough transform to remaining text.

Standard markdown renderers pass block-level raw HTML through unchanged, so the substituted HTML composes cleanly with whatever renderer staticdatagen runs afterwards.

§Example

use ssg::plugin::PluginManager;
use ssg::markdown_ext::MarkdownExtPlugin;

let mut pm = PluginManager::new();
pm.register(MarkdownExtPlugin);

Structs§

MarkdownExtPlugin
Plugin that expands GFM Markdown extensions in source files.

Functions§

expand_gfm
Expands all GFM constructs in input, returning a new string.