Flutter-Bounty-Hunters / static_shock

A static site generator for Dart.
MIT License
59 stars 5 forks source link

Publish table-of-contents data with every Markdown page. #74

Closed matthew-carroll closed 3 months ago

matthew-carroll commented 3 months ago

Publish table-of-contents data with every Markdown page.

The Markdown plugin adds root level data to the Page data structure with the key "tableOfContents".

Example of "tableOfContents" data, accessible from templates:

"tableOfContents": {
  "items": [{
    "title": "...",
    "sectionId": "...",
    "level": 0,
  }],
  "isEmpty": false,
  "isEmptyBeyondLevel": (level) => {},
  "hasMultipleBeyondLevel": (level) => {},
  "linkCountBeyondLevel": (level) => {},
  "renderHtmlList": ({startingLevel}) => {},
}