1
0

gen.js 634 B

12345678910111213141516171819202122232425
  1. import dedent from 'dedent';
  2. import configVals from './config-vals.json.js';
  3. const mdlib = {};
  4. mdlib.h = (out, n, str) => {
  5. out(`${'#'.repeat(n)} ${str}\n\n`);
  6. }
  7. const N_START = 3;
  8. const out = str => process.stdout.write(str);
  9. for ( const configVal of configVals ) {
  10. mdlib.h(out, N_START, `\`${configVal.key}\``);
  11. out(dedent(configVal.description) + '\n\n');
  12. if ( configVal.example_values ) {
  13. mdlib.h(out, N_START + 1, `Examples`);
  14. for ( const example of configVal.example_values ) {
  15. out(`- \`"${configVal.key}": ${JSON.stringify(example)}\`\n`);
  16. }
  17. }
  18. out('\n');
  19. }