Section Lists

Section Lists (section)

Defines the map of options for Platen’s section lists markup. The existing value is a map that includes whether or not to enable the codeblock render hook and its style definition.

When this markup is enabled, you can create a description list for pages in a section of your site with a codeblock.

You can add new keys or replace the values for existing ones. You don’t need to keep the full list of all properties in your own configuration file. Only specify the values you want to add or replace.

JSON Schema

Definition
{
  "$id": "https://platen.io/modules/platen/config/site/markup/section/schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "description": "Defines the options for Platen's section lists markup\n\nhttps://platen.io/modules/platen/config/site/markup/section/",
  "properties": {
    "aliases": {
      "description": "Defines additional language IDs for the codeblock render hook.\n\nhttps://platen.io/modules/platen/config/site/markup/section/#aliases",
      "oneOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "string"
        }
      ],
      "title": "Aliases"
    },
    "enabled": {
      "default": true,
      "description": "Choose whether section codeblock rendering is available for the site.\n\nhttps://platen.io/modules/platen/config/site/markup/section/#enabled",
      "title": "Enable the markup",
      "type": "boolean"
    },
    "partials": {
      "description": "Define a map of partials for Platen to inject as needed.\n\nhttps://platen.io/modules/platen/config/site/markup/section/#partials",
      "properties": {
        "renderers": {
          "description": "Registers one or more partials that act as render hooks.\n\nhttps://platen.io/modules/platen/config/site/markup/section/#renderers",
          "properties": {
            "codeblock": {
              "default": "platen/markup/section/codeblock",
              "description": "Adds a partial to call when processing the codeblock render hook.\n\nhttps://platen.io/modules/platen/config/site/markup/section/#codeblock",
              "title": "Codeblock Render Hook Partial",
              "type": "string"
            }
          },
          "title": "Renderer Partials",
          "type": "object"
        }
      },
      "title": "Markup Partials",
      "type": "object"
    },
    "style": {
      "default": "section",
      "description": "Defines the art markup's simple style module\n\nhttps://platen.io/modules/platen/config/site/markup/section/#style",
      "title": "Markup Simple Style Module",
      "type": "string"
    }
  },
  "title": "Section Lists",
  "type": "object"
}

Enable the markup (enabled)

Choose whether the site renders codeblocks with the section language ID as description lists of pages with their summaries. The default is true.

Aliases (aliases)

Define one or more language IDs to use in addition to the default language ID for codeblocks that render section description lists. The default language ID is section.

You can specify a string or an array of strings. If the value is an array, each item in the array is added as an alias.

Markup Partials (partials)

Define a map of partials for Platen to inject as needed. These partials are only injected when enabled is set to true.

Renderer Partials (renderers)

Defines a map of partials to use as Markdown render hooks. Like all partials, these are only processed when enabled is set to true.

Supported renderer partials include:

  • codeblock, processed for fenced code blocks with a language ID
  • heading, processed for headings
  • image, processed for image links
  • link, processed for non-image links

In all cases, all renderer partials for enabled features and markup options are checked one after the other unless they return a render string. Only the first applicable partial that returns a render string is processed and rendered.

Codeblock Render Hook Partial (codeblock)

Adds support for rendering the linked list of a section’s pages with their summaries. This render hook is only processed when the language ID for a codeblock is section.

It renders the current page’s children inside a <dl> element with a <dt> linking to each page and a <dd containing the page’s summary. The description list is added inside a containing

with optional leading text.

For more information about using codeblocks to add section description lists, see the reference documentation.

This value defaults to platen/markup/section/codeblock. You can replace it with a different value and defining a new partial, or override the existing partial by creating the file layouts/partials/platen/markup/section/codeblock.html in your own site or module.

For more information about defining codeblock render hook partials, see Defining a Codeblock Render Hook Partial in the Theme Guide.

Markup Simple Style Module (style)

Defines default styling for section blocks created by render hooks.

When you use a section render hook, the following SCSS is applied:

.markdown div.platen-section {
  dd dl {
    padding-left: $padding-large;
  }
}

The section block is created as an div (<div>) element with the platen-section class. It contains optional leading rendered Markdown and a description list (<dl>) where each term (<dt>) has the page’s title as an anchor (<a>) element inside it and each definition (<dd>) is the page’s summary, rendered as inline Markdown (without wrapping [sref:<p>] tags if the summary isn’t more than one paragraph).

The only styling added is to ensure that nested description lists are indented by $padding-large so they’re visually distinct from their parent item.

You can overwrite this definition for your own site or theme by creating the file styles/markup/_section.scss in your assets folder, which defaults to assets in your project root.

You can also create a new style module in the styles/markup folder and set this value to that module’s name. If you do, omit the leading _ and trailing .scss. For example, the name for the style module assets/styles/markup/_foo.scss is foo.

Careful!

Note that if you override the style module or this setting,you entirely overwrite the default from the theme.

For more information on authoring SCSS, see the learning guide.

Edit this page