mapcomplete/scripts/generateDocs.ts

26 lines
925 B
TypeScript
Raw Normal View History

import {Utils} from "../Utils";
2021-03-24 02:01:04 +01:00
Utils.runningFromConsole = true;
import SpecialVisualizations from "../UI/SpecialVisualizations";
import {writeFileSync} from "fs";
2021-03-22 01:06:24 +01:00
import {UIElement} from "../UI/UIElement";
import SimpleMetaTagger from "../Logic/SimpleMetaTagger";
2021-03-24 02:01:04 +01:00
import Combine from "../UI/Base/Combine";
import {ExtraFunction} from "../Logic/ExtraFunction";
import ValidatedTextField from "../UI/Input/ValidatedTextField";
2021-03-24 02:01:04 +01:00
2021-03-22 01:06:24 +01:00
const TurndownService = require('turndown')
function WriteFile(filename, html: UIElement) : void {
const md = new TurndownService().turndown(html.InnerRender());
writeFileSync(filename, md);
}
WriteFile("./Docs/SpecialRenderings.md", SpecialVisualizations.HelpMessage)
2021-03-24 02:01:04 +01:00
WriteFile("./Docs/CalculatedTags.md", new Combine([SimpleMetaTagger.HelpText(), ExtraFunction.HelpText()]))
writeFileSync("./Docs/SpecialInputElements", ValidatedTextField.HelpText());
2021-03-22 01:06:24 +01:00
console.log("Generated docs")