Skip to content

All plugins

Markdown, highlighting, search: each is a plugin you add, so your site carries what it uses and nothing else.

Every plugin is a NuGet package and one line in your pipeline:

Terminal
dotnet add package Nacara.Plugin.Markdown --prerelease
let site =
    Site.create "My library"
    |> Site.baseUrl "/"
    |> Markdown.register
    |> TextMate.register
    |> Theme.register theme
    |> Site.collection (Theme.docs theme "content")

Order does not matter, except that the last plugin to claim something wins, which is how one plugin replaces another.

Content

PackageWhat it gives you
Nacara.Plugin.Markdown.md pages, front matter, directives, links checked at build time
Nacara.Plugin.Highlight.TextMateColour in code blocks, from TextMate grammars
Nacara.Plugin.Highlight.TreeSitterThe same, from tree-sitter grammars - a parser rather than patterns
Nacara.Plugin.Literate.fs and .fsx files as pages, prose in comments
Nacara.Plugin.LiveExampleF# snippets a reader edits and runs, compiled in the browser
Nacara.Plugin.ChangelogCHANGELOG.md files published as pages

Publishing

PackageWhat it gives you
Nacara.Plugin.SearchA search box and modal, indexed by Pagefind
Nacara.Plugin.Sitemapsitemap.xml, robots.txt, canonical links
Nacara.Plugin.VersionsSeveral versions side by side, with a switcher
Nacara.Plugin.Deploy.GitHubPagesThe build published to the branch GitHub Pages serves
Nacara.Plugin.Assets.LightningCssSmaller CSS, compiled for the browsers you name
Nacara.Plugin.Assets.EsbuildOne file out of JavaScript that imports its neighbours, minified
Nacara.Plugin.Assets.NuglifySmaller HTML, JavaScript and CSS
Nacara.Plugin.FSharpApiReference pages for an F# library, from the assemblies it ships

Checks

PackageWhat it gives you
Nacara.Plugin.LinkValidatorEvery link the site published, checked
Nacara.Plugin.Linter.RumdlEvery page's markdown, linted by rumdl

Themes

PackageWhat it gives you
Nacara.Theme.DefaultThe layout this site uses: navbar, sidebar, table of contents, dark mode

Its own pages cover customising it, the navbar, menus, and the components you can build your own layout from. Theming in the guide explains what a theme is here, whichever one you use.

Configuring a plugin

Every plugin has register for its defaults and registerWith for anything else. The options are a record, so your editor lists them and the compiler checks them:

|> Markdown.registerWith (fun options ->
    { options with
        GithubRepo = Some "MangelMaxime/Nacara"
        StrictLinks = false
    }
)

The pages above list every option, its default, and what it changes.

Writing your own

A plugin is a Registry -> Registry function in a package of your own: a few lines for a markdown extension, more for something that generates pages. Writing a plugin walks you through it.

Edit this page