JS-TO-MD

raw JSON →
1.0.1 verified Fri May 01 auth: no javascript

A Node.js transpiler that converts JavaScript objects into Markdown for generating dynamic style guides. Current stable version 1.0.1, low release cadence. It traverses the ./src folder, ignoring node_modules, and generates README.md files organized by folder. Key differentiator: simple configuration via JavaScript objects rather than complex templates, but minimal flexibility and no active maintenance.

error Cannot find module 'js-to-md'
cause Package not installed globally or in project's node_modules.
fix
Run 'npm install --save js-to-md' in your project directory.
error ENOENT: no such file or directory, open './src/filename.js'
cause Source file not created in ./src folder.
fix
Create a .js file in the ./src directory with the expected name (e.g., ./src/myguide.js).
gotcha Only files inside ./src folder are traversed; create source files in ./src.
fix Place your .js source files in ./src directory.
gotcha source file name determines output folder: e.g., ./src/javascript.js generates ./javascript/README.md.
fix Name your source file as 'foldername.js' (without README) to control output path.
breaking Version 1.0.1 has no documented breaking changes from 1.0.0.
fix Always test against your existing configs.
npm install js-to-md
yarn add js-to-md
pnpm add js-to-md

Demonstrates converting a JavaScript object to a Markdown style guide file.

const jsToMd = require('js-to-md');
const styleGuide = {
  title: 'My Style Guide',
  sections: [
    {
      name: 'naming--camelcase',
      rule: 'Use camelCase for variable names.',
      lint: { eslint: 'camelcase' },
      examples: {
        lang: 'javascript',
        code: [
          'const myVariable = "good";',
          'const my_variable = "bad";'
        ]
      }
    }
  ]
};
jsToMd(styleGuide, './output');