noogle/indexer/makeMarkdown.js

37 lines
477 B
JavaScript

// simple script
// test.json in generated with "cargo run -- --dir ./test"
const data = require("./test.json");
const fs = require("fs");
const all_docs = data.reduce(
(acc, doc) => `${acc}
## ${doc.name}
### Description
\`\`\`nix
${doc.description}
\`\`\`
### Example
\`\`\`nix
${doc.example}
\`\`\`
### Type
\`\`\`nix
${doc.fn_type}
\`\`\`
`,
""
);
fs.writeFile("content.md", `# Functions\n${all_docs}`, (err) => {
if (err) {
console.error(err);
}
});