Chapters Extension

Accordion-style chapter lists with recursively rendered nested content.

webifier.chapters registers kind: chapters. It renders a list of chapter objects as a Bootstrap accordion. Each item needs a title; any other keys are processed recursively as child content and placed inside the accordion body.

config:
  webifier:
    extensions:
      site:
        uses: webifier.standard
      chapters:
        uses: webifier.chapters
walkthrough:
  kind: chapters
  label: Walkthrough
  content:
    - title: Start
      body: |
        Describe the page in YAML.
    - title: Publish
      body: |
        Commit and let the action rebuild.

Describe the page in YAML.

Commit and let the action rebuild.

Nested child content can itself use another renderer.

nested_walkthrough:
  kind: chapters
  label: Nested Walkthrough
  content:
    - title: Author
      summary: |
        Write content in the repository.
      details:
        kind: chapters
        content:
          - title: Markdown
            body: Use `.md` files for prose.
          - title: Notebooks
            body: Use `.ipynb` files for runnable results.

Write content in the repository.

Use .md files for prose.

Use .ipynb files for runnable results.

Section keys:

  • kind: chapters
  • label: optional section label.
  • content: list of chapter objects.

Chapter item keys:

  • title: accordion heading.
  • any other key: processed as nested Webifier content.

To change the accordion markup, override the macros/chapters.html template. To change how child nodes are processed, register a custom renderer for chapters with override: true.