Minetest-WorldEditAdditions/.docs/Reference.11tydata.js
Starbeamrainbowlabs c8773efe22
Docs: Upgrade reference to support categorical display
It even persists your preference using localStorage!
2021-10-05 02:02:53 +01:00

31 lines
840 B
JavaScript

const fs = require("fs");
const path = require("path");
const parse_sections = require("./lib/parse_sections.js");
let { sections, categories } = parse_sections(fs.readFileSync(
path.resolve(
__dirname,
`../Chat-Command-Reference.md`
),
"utf-8"
))
sections = sections.slice(1).sort((a, b) => a.title.replace(/^\/+/g, "").localeCompare(
b.title.replace(/^\/+/g, "")));
console.log(`REFERENCE SECTION TITLES`)
console.log(sections
.map(s => [s.category, s.title].join(`\t`)).join(`\n`));
console.log(`************************`);
console.log(`REFERENCE SECTION COLOURS`, categories);
module.exports = {
layout: "theme.njk",
title: "Reference",
tags: "navigable",
date: "2001-01-01",
section_intro: sections[0],
sections_help: sections, // Remove the very beginning bit
categories: [...categories.keys()].join("|")
}