Theme
module Theme| Assembly | Nacara.Theme.Default |
| Attributes | [<RequireQualifiedAccess>] |
The default theme: a documentation layout and the assets it needs.
Functions and values
create (options: ThemeOptions) : IPlugin
create (options: ThemeOptions) : IPluginThe theme's assets. Add it to the site alongside the layout you use.
css (value: string) (options: ThemeOptions) : ThemeOptions
css (value: string) (options: ThemeOptions) : ThemeOptionsCSS added to every page, after the theme's own.
For a rule or two - a token to override, one section to treat differently. Anything larger belongs in a file of its own, shipped as a static asset and linked with headExtra.
| Parameter | |
|---|---|
value | The rules, as they would be written in a stylesheet. |
options | The options so far. |
Theme.defaults
|> Theme.css """[data-section="reference"] { --nacara-sidebar-width: 20rem; }"""
defaults: ThemeOptionsdocs (options: ThemeOptions) (name: string) : Collection<DocFrontMatter>
docs (options: ThemeOptions) (name: string) : Collection<DocFrontMatter>A documentation collection using the theme's front matter and layout.
| Parameter | |
|---|---|
options | The theme's own configuration, which its layout is given. |
name | What the collection is called, which is also the directory its content is read from. |
Site.create "Nacara" |> Site.collection (Theme.docs options "docs")
editUrl (value: string) (options: ThemeOptions) : ThemeOptions
editUrl (value: string) (options: ThemeOptions) : ThemeOptionsBase URL for the "edit this page" link.
| Parameter | |
|---|---|
value | Where an edit starts, such as https://github.com/owner/repo/edit/main/docs. |
options | The options so far. |
favIcon (value: string) (options: ThemeOptions) : ThemeOptions
favIcon (value: string) (options: ThemeOptions) : ThemeOptionsThe site's favicon.
| Parameter | |
|---|---|
value | Its path, relative to the site root. |
options | The options so far. |
headExtra (value: ReactElement list) (options: ThemeOptions) : ThemeOptions
headExtra (value: ReactElement list) (options: ThemeOptions) : ThemeOptionsMarkup added at the end of <head> on every page.
| Parameter | |
|---|---|
value | What to add - an analytics snippet, a font, a meta tag. |
options | The options so far. |
layout (options: ThemeOptions) (context: PageContext<DocFrontMatter>) : ReactElement
layout (options: ThemeOptions) (context: PageContext<DocFrontMatter>) : ReactElementThe layout for pages using the theme's own front matter.
| Parameter | |
|---|---|
options | The theme's own configuration. |
context | The page and the site around it. Its front matter is read for the title, the description and which parts of the chrome to leave out. |
register (options: ThemeOptions) (site: Site) : Site
register (options: ThemeOptions) (site: Site) : SiteAdd the theme's assets to a site.
Registers what the theme needs of the site. The layout is chosen per collection, with docs or layout.
| Parameter | |
|---|---|
options | The theme's options: your navbar, your footer, your menus. |
site | The site you are describing. |
shell<'FrontMatter> (options: ThemeOptions) (doc: DocPage) (context: PageContext<'FrontMatter>) : ReactElement
shell<'FrontMatter> (options: ThemeOptions) (doc: DocPage) (context: PageContext<'FrontMatter>) : ReactElementRender a full page with the theme's chrome.
Takes a DocPage rather than reading front matter itself, so a site with its own front-matter type uses the same layout by mapping onto that record.
| Parameter | |
|---|---|
options | The theme's own configuration: navbar, menus, footer. |
doc | What the theme needs to know about this page - its title, and which parts of the chrome it wants. |
context | The page and the site around it, whatever front-matter type the site declared. |