1const fs = require("fs");
2const path = require("path");
3const matter = require("gray-matter");
4const toml = require("@iarna/toml");
8 toml: toml.parse.bind(toml),
16function buildGlossary(dir) {
17 const children = fs.readdirSync(dir, { withFileTypes: true });
18 const pages = children.filter((f) => f.isFile() && f.name !== "_index.md");
19 const subdirs = children.filter(
20 (f) => f.isDirectory()
23 const { data } = matter(fs.readFileSync(path.join(dir, page.name)), options);
24 const glossaryEntry = data.glossaryEntry
25 ? Object.values(data.glossaryEntry)
28 url: "https://urbit.org" + path.join(
29 dir.substr(dir.indexOf("content") + 7),
31 page.name.replace(/.md$/, "")
36 glossaryEntry.forEach((entry) => glossary.push(entry));
40 subdirs.map((subdir) => [
42 buildGlossary(path.join(dir, subdir.name)),
47buildGlossary(path.join(process.cwd(), "content"));
48const fileContents = `export const glossary = ${JSON.stringify(glossary)}`;
51 fs.readdirSync("cache");
53 fs.mkdirSync("cache");
56fs.writeFile("cache/glossary.js", fileContents, function (err) {
57 if (err) return console.error(err);
58 console.log("Site glossary created.");
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list