nixtml

Configuration Options

Generated reference for the options exposed by nixtml's modules

This reference is generated directly from nixtml's module options. In an imported module, use the full option names shown below. mkWebsite exposes common website settings as top-level arguments such as content, collections, and layouts.

build.extraPackages#

Extra packages that will be joined with the final website package.

Type: attribute set of package

Default: { }

Example:

{
  stylesheetPackage =
      let
        bulma = pkgs.fetchFromGitHub {
          owner = "jgthms";
          repo = "bulma";
          rev = "1.0.4";
          hash = "sha256-hlejqBI6ayzhm15IymrzhTevkl3xffMfdTasZ2CmAas=";
        };

        deps = pkgs.linkFarm "nixtml-docs-stylesheet-deps" [
          {
            name = "bulma";
            path = bulma;
          }
        ];
      in
      pkgs.stdenv.mkDerivation {
        name = "nixtml-docs-stylesheet";

        src = ./stylesheet;

        buildInputs = with pkgs; [
          dart-sass
        ];

        buildPhase = ''
          sass --load-path "${deps}" main.scss main.css
        '';

        installPhase = ''
          mkdir -p $out/css

          cp main.css $out/css/main.css
        '';
      };
}

Declared by:

build.website#

Final built website package.

Type: package

Declared by:

website.baseURL#

Base URL of the generated website. Used for generating permalinks.

Type: string matching the pattern ^https?://.*

Declared by:

website.collections#

Collections allow you to group, paginate and list related content such as blog posts or portfolio pieces.

Type: attribute set of (submodule)

Default: { }

Example:

{
  path = "blog/posts";
  pagination.perPage = 5;
  taxonomies = [ "tags" ];
}

Declared by:

website.collections.<name>.groupBy#

Taxonomy used to collapse items in the collection's listing pages.

Items sharing the first term of this taxonomy are replaced by a single group entry, placed where the newest of them would be. Group entries have isGroup = true, taxonomy, term, title (the term), url (the term's taxonomy page, or null if the taxonomy is not in taxonomies), the date values of the newest item and items with the grouped items, oldest first. Terms with a single item are not grouped.

Only the collection listing pages are affected; taxonomy pages and RSS feeds still list every item.

Type: null or string

Default: null

Example: "series"

Declared by:

website.collections.<name>.pagination.perPage#

Number of collection item per page when rendering the pagination.

Type: signed integer

Default: 5

Declared by:

website.collections.<name>.path#

Path to folder in config.website.content.dir that contains items for the collection.

For example if all blog posts are kept in ./content/blog/posts and config.website.content.dir = ./content;, setting this option to "blog/posts" will create a collection for the blog posts. The collection will automatically create pages (such as page 1 at blog/index.html, page 2 at blog/page/2/index.html, etc.) using template config.website.layouts.collection and an RSS feed for the collection (if enabled) at blog/index.xml.

Type: string

Declared by:

website.collections.<name>.rss.enable#

Whether or not to automatically create an RSS feed for this collection.

Type: boolean

Default: true

Declared by:

website.collections.<name>.rss.limit#

Max number of collection items to include in the RSS feed.

Type: signed integer

Default: 50

Declared by:

website.collections.<name>.taxonomies#

Taxonomies to enable for the collection.

Type: list of string

Default: [ ]

Example:

[
  "tags"
]

Declared by:

website.content.dir#

Path to a directory with markdown content.

Type: absolute path

Declared by:

website.content.pages#

Attribute set of pages to be processed by a content processor (see config.website.content.processors). The content can come either from text or source.

Keep in mind that nixtml will automatically populate this by walking config.website.content.dir and finding content.

Type: attribute set of (submodule)

Default: { }

Example:

{
  "index" = {
    text = ''
      ---
      title: Homepage
      ---
      # Welcome!

      Welcome to the hompage
    '';
    processor = "md";
  };
  "nested/page" = {
    source = ./path/to/page.md;
    processor = "md";
  };
}

Declared by:

website.content.pages.<name>.processor#

Name of the processor to use to render the page content.

Type: value "md" (singular enum)

Default: "md"

Declared by:

website.content.pages.<name>.source#

Path to to a source file with content that should be processed with the desired processor.

Type: absolute path

Declared by:

website.content.pages.<name>.text#

Content that should be processed with the desired processor.

Type: null or string

Default: null

Declared by:

website.content.processors.md.extraPythonPackages#

Extra python packages to use for processing markdown content.

Type: list of package

Default: [ ]

Declared by:

website.content.processors.md.highlightStylesheet#

A CSS file with the configured Pygments styles from website.content.processors.md.settings.highlight.style, in their configured order.

Useful when website.content.processors.md.settings.highlight.noclasses is set to false.

Type: package

Declared by:

website.content.processors.md.settings.admonition.enable#

Whether to enable admonition blocks, e.g. /// note.

Type: boolean

Default: true

Declared by:

website.content.processors.md.settings.admonition.extraConfig#

Extra config passed to the pymdownx.blocks.admonition extension. Takes precedence over the other settings for this extension.

See: https://facelessuser.github.io/pymdown-extensions/extensions/blocks/plugins/admonition/

Type: attribute set of anything

Default: { }

Declared by:

website.content.processors.md.settings.admonition.types#

Admonition types to create shorthand blocks for, e.g. note allows /// note instead of /// admonition | Note.

Type: list of (string or (submodule))

Default: ["note""attention""caution""danger""error""tip""hint""warning""important"]

Example:

[
  "note"
  "warning"
  { name = "example"; title = "Try it"; }
]

Declared by:

website.content.processors.md.settings.attrList.enable#

Whether to enable attribute lists, e.g. {: .class #id }.

Type: boolean

Default: true

Declared by:

website.content.processors.md.settings.caption.auto#

Whether to automatically number captions of types with a prefix.

Type: boolean

Default: true

Declared by:

website.content.processors.md.settings.caption.autoLevel#

Depth of nested figures to automatically number. 0 numbers all levels, 1 only the outermost figures, and so on.

Type: unsigned integer, meaning >=0

Default: 0

Declared by:

website.content.processors.md.settings.caption.enable#

Whether to enable caption blocks, e.g. /// caption.

Type: boolean

Default: true

Declared by:

website.content.processors.md.settings.caption.extraConfig#

Extra config passed to the pymdownx.blocks.caption extension. Takes precedence over the other settings for this extension.

See: https://facelessuser.github.io/pymdown-extensions/extensions/blocks/plugins/caption/

Type: attribute set of anything

Default: { }

Declared by:

website.content.processors.md.settings.caption.prepend#

Whether to place captions before the content instead of after it.

Type: boolean

Default: false

Declared by:

website.content.processors.md.settings.caption.types#

Caption types to create blocks for. Types with a prefix are numbered.

Type: list of (string or (submodule))

Default: ["caption"{name = "figure-caption";prefix = "Figure {}.";}{name = "table-caption";prefix = "Table {}.";}]

Declared by:

website.content.processors.md.settings.dateFormat#

Format string for any datetime in content front matter.

This is a format string for python's strftime. See: https://docs.python.org/3/library/datetime.html#strftime-strptime-behavior

Type: string

Default: "%b %-d, %Y"

Declared by:

website.content.processors.md.settings.definition.enable#

Whether to enable definition list blocks, e.g. /// define.

Type: boolean

Default: true

Declared by:

website.content.processors.md.settings.details.enable#

Whether to enable collapsible details blocks, e.g. /// details | Summary.

Type: boolean

Default: true

Declared by:

website.content.processors.md.settings.details.extraConfig#

Extra config passed to the pymdownx.blocks.details extension. Takes precedence over the other settings for this extension.

See: https://facelessuser.github.io/pymdown-extensions/extensions/blocks/plugins/details/

Type: attribute set of anything

Default: { }

Declared by:

website.content.processors.md.settings.details.types#

Details types to create shorthand blocks for, e.g. note allows /// note | Summary as a collapsible block with the note class.

Note that these share names with admonition types, so a type should only be defined in one of them.

Type: list of (string or (submodule))

Default: [ ]

Example:

[
  "note"
  "warning"
]

Declared by:

website.content.processors.md.settings.extensions#

Additional Python-Markdown extensions to enable, keyed by their import name, along with their config.

Extensions from packages other than markdown and pymdown-extensions need to be added to website.content.processors.md.extraPythonPackages.

Extensions that nixtml manages through named settings, e.g. toc or pymdownx.blocks.tab, can't be added here. Older extensions superseded by the enabled built-in ones conflict with them: def_list with definition, pymdownx.tabbed with tab and sane_lists with fancylists are errors, while admonition and pymdownx.details only warn. Disable the built-in setting to use the older extension.

Type: attribute set of (submodule)

Default: { }

Example:

{
  "pymdownx.arithmatex".config.generic = true;
  "pymdownx.emoji" = { };
  abbr = { };
}

Declared by:

website.content.processors.md.settings.extensions.<name>.config#

Config passed to the extension.

Type: attribute set of anything

Default: { }

Declared by:

website.content.processors.md.settings.extensions.<name>.enable#

Whether to enable this extension.

Type: boolean

Default: true

Declared by:

website.content.processors.md.settings.fancylists.additionalOrderedStyles#

Ordered list styles to support in addition to decimal numbers. generic enables #. as a list marker.

Type: list of (one of "roman", "alpha", "generic")

Default: ["roman""alpha""generic"]

Declared by:

website.content.processors.md.settings.fancylists.enable#

Whether to enable pymdownx.fancylists, supporting alphabetical and roman numeral ordered lists.

Type: boolean

Default: true

Declared by:

website.content.processors.md.settings.fancylists.extraConfig#

Extra config passed to the pymdownx.fancylists extension. Takes precedence over the other settings for this extension.

See: https://facelessuser.github.io/pymdown-extensions/extensions/fancylists/

Type: attribute set of anything

Default: { }

Declared by:

website.content.processors.md.settings.fancylists.injectClass#

Whether to inject a class indicating the list-style-type on ordered lists.

Type: boolean

Default: false

Declared by:

website.content.processors.md.settings.fancylists.injectStyle#

Whether to inject a list-style-type style attribute on ordered lists.

Type: boolean

Default: false

Declared by:

website.content.processors.md.settings.footnotes.enable#

Whether to enable footnotes.

Type: boolean

Default: true

Declared by:

website.content.processors.md.settings.footnotes.extraConfig#

Extra config passed to the footnotes extension. Takes precedence over the other settings for this extension.

See: https://python-markdown.github.io/extensions/footnotes/

Type: attribute set of anything

Default: { }

Declared by:

website.content.processors.md.settings.highlight.extraConfig#

Extra config passed to the pymdownx.highlight extension. Takes precedence over other highlight settings.

See: https://facelessuser.github.io/pymdown-extensions/extensions/highlight/#options

Type: attribute set of anything

Default: { }

Example:

{
  anchor_linenums = true;
  line_spans = "__span";
}

Declared by:

website.content.processors.md.settings.highlight.linenums#

Enable line numbers for all code blocks. When null line numbers can still be enabled per code block with linenums="1".

Type: null or boolean

Default: null

Declared by:

website.content.processors.md.settings.highlight.linenumsStyle#

The line number style to use for code blocks.

See: https://facelessuser.github.io/pymdown-extensions/extensions/highlight/#line-number-styles

Type: one of "table", "inline", "pymdownx-inline"

Default: "table"

Declared by:

website.content.processors.md.settings.highlight.noclasses#

Whether to inline the pygments styles in the generated HTML instead of using CSS classes.

When set to false a stylesheet for the chosen style is needed, see website.content.processors.md.highlightStylesheet.

Note that the pymdownx-inline line number style requires this to be false.

Type: boolean

Default: true

Declared by:

website.content.processors.md.settings.highlight.style#

The Pygments styles to use for code block colorschemes.

A string is shorthand for a single style scoped to .highlight. A list can define multiple styles with custom selectors and media feature conditions. The first style is used for inline highlighting, and all styles are included in highlightStylesheet in their configured order.

Type: (non-empty (list of (submodule))) or string convertible to it

Default: [{name = "default";}]

Declared by:

website.content.processors.md.settings.highlight.style.*.media#

An optional media feature condition, without parentheses.

Type: null or string

Default: null

Declared by:

website.content.processors.md.settings.highlight.style.*.name#

The Pygments style name.

Type: string

Declared by:

website.content.processors.md.settings.highlight.style.*.selector#

The CSS selector to scope this style to.

Type: string

Default: ".highlight"

Declared by:

website.content.processors.md.settings.magiclink.enable#

Whether to enable automatic linking of URLs and email addresses.

Type: boolean

Default: true

Declared by:

website.content.processors.md.settings.magiclink.extraConfig#

Extra config passed to the pymdownx.magiclink extension. Takes precedence over the other settings for this extension.

See: https://facelessuser.github.io/pymdown-extensions/extensions/magiclink/

Type: attribute set of anything

Default: { }

Declared by:

website.content.processors.md.settings.magiclink.hideProtocol#

Whether to display links without the https:// (or similar) prefix.

Type: boolean

Default: false

Declared by:

website.content.processors.md.settings.magiclink.provider#

Provider used for repository shorthand links.

Type: one of "github", "gitlab", "bitbucket"

Default: "github"

Declared by:

website.content.processors.md.settings.magiclink.repo#

Default repository for repository shorthand links.

Type: null or string

Default: null

Declared by:

website.content.processors.md.settings.magiclink.repoUrlShortener#

Whether to shorten links to repository issues, pull requests and commits.

Type: boolean

Default: false

Declared by:

website.content.processors.md.settings.magiclink.repoUrlShorthand#

Whether to convert shorthand references such as #123 or user/repo#123 to links. Requires user and repo to be set for the short forms.

Type: boolean

Default: false

Declared by:

website.content.processors.md.settings.magiclink.user#

Default user for repository shorthand links.

Type: null or string

Default: null

Declared by:

website.content.processors.md.settings.quotes.callouts#

Whether to enable GitHub/Obsidian style callouts, e.g. > [!NOTE].

Callouts render with the same markup as admonitions, or as collapsible details when followed by - or +.

Type: boolean

Default: true

Declared by:

website.content.processors.md.settings.quotes.enable#

Whether to enable pymdownx.quotes blockquotes, which replace the default blockquote handling.

Type: boolean

Default: true

Declared by:

website.content.processors.md.settings.quotes.extraConfig#

Extra config passed to the pymdownx.quotes extension. Takes precedence over the other settings for this extension.

See: https://facelessuser.github.io/pymdown-extensions/extensions/quotes/

Type: attribute set of anything

Default: { }

Declared by:

website.content.processors.md.settings.relativeLinks.enable#

Whether to resolve relative links and image sources against the Markdown file's location, like on GitHub, instead of the page's URL.

Links to other Markdown files are rewritten to the URL of their page, e.g. [Setup](./setup.md#install) in guide/intro.md becomes ../setup/#install on the page at guide/intro/. Other relative URLs, e.g. images in website.static.dir, are rewritten to stay correct from the page's URL, so ![Diagram](../images/diagram.png) in guide/intro.md points to /images/diagram.png.

Absolute URLs, URLs starting with / and links to anchors on the same page are left alone. Pages are expected at their default path, i.e. guide/setup.md at guide/setup/ and guide/index.md at guide/. Links to missing files are not detected.

Type: boolean

Default: false

Declared by:

website.content.processors.md.settings.tab.alternateStyle#

Whether to use the alternate tab markup, which is easier to style and handles overflowing tabs better.

See: https://facelessuser.github.io/pymdown-extensions/extensions/blocks/plugins/tab/#alternate-style

Type: boolean

Default: true

Declared by:

website.content.processors.md.settings.tab.enable#

Whether to enable tab blocks, e.g. /// tab | Title.

Type: boolean

Default: true

Declared by:

website.content.processors.md.settings.tab.extraConfig#

Extra config passed to the pymdownx.blocks.tab extension. Takes precedence over the other settings for this extension.

See: https://facelessuser.github.io/pymdown-extensions/extensions/blocks/plugins/tab/

Type: attribute set of anything

Default: { }

Declared by:

website.content.processors.md.settings.tables.enable#

Whether to enable tables.

Type: boolean

Default: true

Declared by:

website.content.processors.md.settings.tables.extraConfig#

Extra config passed to the tables extension. Takes precedence over the other settings for this extension.

See: https://python-markdown.github.io/extensions/tables/

Type: attribute set of anything

Default: { }

Declared by:

website.content.processors.md.settings.tasklist.clickableCheckbox#

Whether checkboxes can be checked and unchecked by the reader.

Type: boolean

Default: false

Declared by:

website.content.processors.md.settings.tasklist.customCheckbox#

Whether to add an empty <label> after each checkbox to allow for custom styling.

Type: boolean

Default: false

Declared by:

website.content.processors.md.settings.tasklist.enable#

Whether to enable task lists, e.g. - [x] done.

Type: boolean

Default: true

Declared by:

website.content.processors.md.settings.tasklist.extraConfig#

Extra config passed to the pymdownx.tasklist extension. Takes precedence over the other settings for this extension.

See: https://facelessuser.github.io/pymdown-extensions/extensions/tasklist/

Type: attribute set of anything

Default: { }

Declared by:

Set to true to cause all headers to link to themselves.

Type: boolean

Default: false

Declared by:

website.content.processors.md.settings.toc.anchorlinkClass#

CSS class(es) used for the link.

Type: string

Default: "toclink"

Declared by:

website.content.processors.md.settings.toc.marker#

Text to find and replace with the Table of Contents.

Set to an empty string to disable searching for a marker, which may save some time, especially on long documents.

Type: string

Default: "[TOC]"

Declared by:

Set to true or a string to generate permanent links at the end of each header.

When set to true the paragraph symbol (¶ or “&para;”) is used as the link text. When set to a string, the provided string is used as the link text.

Type: boolean or string

Default: false

Declared by:

website.content.processors.md.settings.toc.permalinkClass#

CSS class(es) used for the link.

Type: string

Default: "headerlink"

Declared by:

website.content.processors.md.settings.toc.title#

Title to insert in the Table of Contents’ <div>.

Type: null or string

Default: null

Declared by:

website.content.processors.md.settings.toc.titleClass#

CSS class used for the title contained in the Table of Contents.

Type: string

Default: "toctitle"

Declared by:

website.content.processors.md.settings.toc.tocClass#

CSS class(es) used for the <div> containing the Table of Contents.

Type: string

Default: "toc"

Declared by:

website.files#

Files written to the website build output.

Type: attribute set of (submodule)

Default: { }

Declared by:

website.files.<name>.path#

Path of output file.

Type: string

Default: "‹name›"

Declared by:

website.files.<name>.source#

Path of the source file.

Type: absolute path

Declared by:

website.files.<name>.text#

Text of the output file.

Type: null or strings concatenated with "\n"

Default: null

Declared by:

website.layouts.base#

Base template used as the skeleton for every page defined in config.website.pages.

Type: function that evaluates to a(n) (string or (list of string) convertible to it)

Example:

let
  inherit (lib.tags)
    html
    head
    body
    title
    div
    meta
    ;
  inherit (lib) attrs;
  inherit (config.website) metadata;
in {path, content, ...}:
  "<!DOCTYPE html>\n"
  +
    html
      [ (attrs.lang metadata.lang) ]
      [
        (head
          [ ]
          [
            (title metadata.title)
            (meta [
              (attrs.property "og:type")
              (attrs.content (if path == [ "index" ] then "website" else "article"))
            ])
          ]
        )
        (body
          [
            (attrs.classes [
              "font-sans"
              "bg-white"
            ])
          ]
          [
            (div
              [
                (attrs.classes [ "container" ])
              ]
              [ content ]
            )
          ]
        )
      ]

Declared by:

website.layouts.collection#

Template used for rendering pagination of items in a collection. See config.website.collections.

Type: function that evaluates to a(n) (string or (list of string) convertible to it)

Declared by:

website.layouts.home#

Template used for rendering index.md inside config.website.content.dir.

Type: function that evaluates to a(n) (string or (list of string) convertible to it)

Declared by:

website.layouts.page#

Template used for rendering any parsed markdown file (apart from index.md) inside config.website.content.dir.

Type: function that evaluates to a(n) (string or (list of string) convertible to it)

Declared by:

website.layouts.partials#

Arbritary attribute set of templates to be used in the main layouts.

Type: attribute set of function that evaluates to a(n) (string or (list of string) convertible to it)

Default: { }

Declared by:

website.layouts.taxonomy#

Template used for rendering pagination of items in a taxonomy of a collection. See config.website.collections.<name>.taxonomies.

Type: function that evaluates to a(n) (string or (list of string) convertible to it)

Declared by:

website.metadata#

Website wide metadata to be used for templating the website.

Type: attribute set of anything

Default: { }

Declared by:

website.name#

Name of the website.

Type: string

Declared by:

website.pages#

Attribute set of pages to be templated and put in the final build output. Keep in mind that setting config.website.content.dir and config.website.collections populates this attribute set with pages it generates.

Templated pages are automatically passed to config.website.files and included in the final website build derivation.

Type: attribute set of (submodule)

Default: { }

Declared by:

website.pages.<name>.extraContext#

Extra context to pass on to the layout template when rendering this page.

Type: lazy attribute set of anything

Default: { }

Declared by:

website.pages.<name>.lastModified#

Date in the W3C Datetime format. This is used for generating sitemap.xml.

Type: null or string

Default: null

Declared by:

website.pages.<name>.layout#

The layout template to use to render this page.

Type: function that evaluates to a(n) (string or (list of string) convertible to it)

Declared by:

website.pages.<name>.path#

The final path of the of the page.

The value is normalized when generating the final website output.

  • If this ends with .html, the value is unchanged. Example: 404.html.
  • If this ends with index, only .html is appended. Example: about/index -> about/index.html.
  • Otherwise /index.html is appended. Example: about -> about/index.html.

Type: string

Default: "‹name›"

Declared by:

website.sitemap.enable#

Whether or not to automatically generate a sitemap.xml file in the website build output.

Type: boolean

Default: true

Declared by:

website.static.dir#

Path to a directory with static content. All files will be copied to the final build derivation as is.

Type: null or absolute path

Default: null

Declared by: