Skip to content

Markdown

module Markdown
AssemblyNacara.Plugin.Markdown
Attributes[<RequireQualifiedAccess>]

Functions and values

create () : IPlugin

The markdown plugin, with its default options.

createWith (configure: MarkdownOptions -> MarkdownOptions) : IPlugin

The markdown plugin, configured.

Parameter
configureGiven the defaults, the options to use. Anything it leaves alone keeps its default.
defaults: MarkdownOptions
directive (name: string) (render: DirectiveContext -> ReactElement) (site: Site) : Site

Add a :::name directive of your own to a site.

Parameter
nameWhat follows the colons, matched ignoring case.
renderGiven what the directive holds, its markup.
siteThe site being described.
Site.create "Blog"
|> Markdown.register
|> Markdown.directive "youtube" (fun directive ->
Html.iframe [ prop.src $"https://www.youtube-nocookie.com/embed/{directive.Argument.Value}" ]
)
directivePlugin (name: string) (render: DirectiveContext -> ReactElement) : IPlugin

A :::name directive of your own, as a plugin.

It takes precedence over a built-in directive of the same name. Of two with the same name, the one registered last is used.

Parameter
nameWhat follows the colons, matched ignoring case.
renderGiven what the directive holds, its markup. An exception it throws fails the build at the directive's line.
frontMatterFormat: FrontMatterFormat

How a markdown file carries its front matter: a block at the top of the file.

githubRepo (value: string option) (options: MarkdownOptions) : MarkdownOptions

Repository used to expand issue and commit references, for example MangelMaxime/Nacara.

Parameter
valueThe value to use.
optionsThe options so far.
register (site: Site) : Site

Add markdown to a site.

Site.create "Docs" |> Markdown.register
registerWith (configure: MarkdownOptions -> MarkdownOptions) (site: Site) : Site

Add markdown to a site, configured.

Parameter
configureGiven the defaults, the options to use. Anything it leaves alone keeps its default.
siteThe site being described.
renderBlock<'FrontMatter> (context: PageContext<'FrontMatter>) (text: string) : ReactElement

Markdown from front matter or data, rendered as a block: paragraphs, lists.

Links resolve as they do in a page: to a file beside the page, or from the project root with a leading /. A link that names no file is looked up by source path, then kept as a path in the site. One that resolves to nothing is written as it is, for the link validator to report.

Parameter
contextThe page being rendered.
textThe markdown.
renderInline<'FrontMatter> (context: PageContext<'FrontMatter>) (text: string) : ReactElement

Markdown from front matter or data, rendered as a run of text, with no paragraph around it.

Links resolve as with renderBlock. Text of several paragraphs keeps them.

Parameter
contextThe page being rendered.
textThe markdown.
strictLinks (value: bool) (options: MarkdownOptions) : MarkdownOptions

Fail the build on a link that points at no page.

Parameter
valueThe value to use.
optionsThe options so far.
toc (value: TocRange) (options: MarkdownOptions) : MarkdownOptions

Heading levels collected into the table of contents, for pages that do not say.

Parameter
valueThe value to use.
optionsThe options so far.
warnOnUnknownLanguage (value: bool) (options: MarkdownOptions) : MarkdownOptions

Report a fence naming a language no highlighter covers.

Parameter
valueThe value to use.
optionsThe options so far.