Files
rappaurio-sae501_502/app/node_modules/hyntax/generate-toc.js
2023-09-25 09:41:55 +02:00

18 lines
350 B
JavaScript

#!/usr/bin/env node
const fs = require('fs')
const remark = require('remark')
const toc = require('remark-toc')
const readme = fs.readFileSync('./README.md').toString()
remark()
.use(toc, { tight: true, maxDepth: 2 })
.process(readme, function (err, file) {
if (err) {
throw err
}
fs.writeFileSync('./README.md', file)
})