Built-in plugins

Eight plugins ship with tryck. They are all enabled by default; a plugin with no section in the config file is still active. Configure a plugin under its name in the plugins section, and turn it off with enabled: false.

1plugins:
2  mermaid:
3    enabled: false
4  readingTime:
5    wordsPerMinute: 250

An unknown option in a plugin section is a config.unknownKey warning, and an unknown plugin name is a config.unknownKey warning as well.

Plugin Options Default Does
toc — on Adds a table of contents.
readingTime wordsPerMinute 200 Counts words and estimates reading time.
syntaxHighlighting theme, darkTheme, lineNumbers github, github-dark, true Highlights code and writes /css/chroma.css.
linkCheck failOnBroken true Checks internal links and anchors.
sitemap — on Writes /sitemap.xml.
search maxTextLength 5000 Writes /search-index.json.
redirects — on Writes a redirect page per front matter alias.
mermaid url jsDelivr mermaid 11 Draws ```mermaid blocks.

toc

Builds each page's table of contents from its headings and stores it as .TOC in layouts and Data["toc"] for plugins. Configure its depth with defaults.tocDepth and whether it is on with defaults.toc; a page's toc: true/false front matter overrides the default. The plugin itself has no options, but can be disabled with plugins.toc.enabled: false. See Layouts and templates.

readingTime

Counts the words in a page's body — leaving out code blocks and raw HTML — and stores Data["wordCount"] and Data["readingTime"] (whole minutes, at least 1). The post layout shows it. wordsPerMinute must be positive.

syntaxHighlighting

Highlights fenced code blocks with chroma using CSS classes, and writes the theme's rules to /css/chroma.css. theme styles light mode, darkTheme dark mode (empty uses theme in both), and lineNumbers shows line numbers. See Code and diagrams.

linkCheck

Records internal links while pages are parsed and checks them once every page, asset and generated file is known. A link to something that does not exist is link.broken: an error during tryck build when failOnBroken is true (the default), and a warning during tryck dev. A missing #fragment is link.anchor, a warning. It runs after the other finalizers so it can see the files they added.

sitemap

Writes /sitemap.xml with an absolute URL for every page that is not a draft. It needs a site.baseUrl with a host, otherwise it reports sitemap.baseUrl and writes nothing. A page's date becomes the entry's lastmod.

Writes /search-index.json, an array of {url, title, headings, text} for every non-draft page. Code blocks are left out of the text, which is truncated to maxTextLength bytes. The built-in theme has no search box yet; a custom layout can load the index:

1<script>
2fetch("{{ relURL "/search-index.json" }}").then((r) => r.json()).then((pages) => { /* ... */ });
3</script>

redirects

Writes a small meta-refresh page for every aliases entry in a page's front matter. An alias must start with /; otherwise it is a redirect.alias error. See Front matter.

mermaid

Renders ```mermaid code blocks as diagrams and adds a module script to pages that contain one. The url option is the module to load; the default is mermaid 11 from jsDelivr. Point it at a file under static/ to work offline. See Code and diagrams.