Skip to content

DocsOptions

type DocsOptions =
    {
        Navbar: NavbarItem list
        NavbarEnd: NavbarItem list
        BrandIcon: BrandIcon option
        Menus: Map<string,MenuItem list>
        EditUrlBase: string option
        MenuLimit: int
        MenuGroupLimit: int
    }
AssemblyNacara.Theme.Docs

What a documentation theme is told about the site it draws.

The part of a theme's options every documentation theme shares: what the navbar holds, which menu each section shows, where a page's source is. A theme adds its own options beside these.

Fields

Navbar: NavbarItem list
NavbarEnd: NavbarItem list
BrandIcon: BrandIcon option

The icon before the site's title in the navbar.

Menus: Map<string,MenuItem list>

Explicit menus, keyed by the first segment of a page's route. Sections with no entry here get a menu built from their pages.

EditUrlBase: string option

Base URL for "edit this page" links, for example https://github.com/MangelMaxime/Nacara/edit/main/.

MenuLimit: int

How many pages a section's menu writes into a page before it prunes.

Under it the menu is written whole, so the filter box covers every page it holds. 0 never prunes, whatever it costs.

MenuGroupLimit: int

Which groups are pruned, once a menu is over MenuLimit.

A group of more than this keeps the trail to the page being read and a link to its own page. Then, while the menu is over MenuLimit, the largest group that does not lead to the page being read keeps only the link. 0 prunes no group.

Functions and values

brandIcon (value: BrandIcon) (options: DocsOptions) : DocsOptions

The icon before the site's title in the navbar.

Parameter
valueAn image file or SVG markup.
optionsThe options so far.
defaults: DocsOptions
editUrl (value: string) (options: DocsOptions) : DocsOptions

Base URL for the "edit this page" link.

Parameter
valueWhere an edit starts, such as https://github.com/owner/repo/edit/main/docs.
optionsThe options so far.
menu (section: string) (items: MenuItem list) (options: DocsOptions) : DocsOptions

The menu for one section, replacing the one its pages would have produced.

Additive: call it once per section. A section you say nothing about gets a menu built from its pages, or the one a plugin offered.

Parameter
sectionThe first segment of the routes it covers, such as guide.
itemsWhat the menu holds.
optionsThe options so far.
menuGroupLimit (value: int) (options: DocsOptions) : DocsOptions

Which groups are pruned, once a menu is over the limit.

Parameter
valueThe value to use. 0 prunes none of them.
optionsThe options so far.
menuLimit (value: int) (options: DocsOptions) : DocsOptions

How many pages a section's menu writes into a page before it prunes.

Parameter
valueThe value to use. 0 never prunes.
optionsThe options so far.
menus (value: Map<string,MenuItem list>) (options: DocsOptions) : DocsOptions

Every menu at once, replacing any set before.

Parameter
valueThe menus, keyed by section.
optionsThe options so far.
navbar (value: NavbarItem list) (options: DocsOptions) : DocsOptions

The items on the left of the navbar, after the site's title.

Parameter
valueThe items, in the order they are shown.
optionsThe options so far.
navbarEnd (value: NavbarItem list) (options: DocsOptions) : DocsOptions

The items on the right of the navbar - search, a repository link, the theme toggle.

Parameter
valueThe items, in the order they are shown.
optionsThe options so far.