How to use the documentation.formats.md function in documentation

To help you get started, we’ve selected a few documentation examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sergioramos / apr / scripts / build-docs.js View on Github external
forEach(packages, async name => {
    const dir = path.join(__dirname, `../packages/${name}`);
    const pkg = require(path.join(dir, 'package.json'));

    const ast = await build([path.join(dir, 'index.js')], {});

    const dsc =
      ast.length && ast[0] && ast[0].description
        ? removeMd(
            remark()
              .stringify(ast[0].description)
              .split(/\n/)[1]
          )
        : pkg.dsc;

    const readme = await formats.md(ast, {});

    const pjson = JSON.stringify(
      {
        name: `apr-${name}`,
        license: apr.license,
        version: pkg.version,
        description: dsc,
        keywords: union((pkg.keywords || []).concat(name).concat(apr.keywords)),
        homepage: `https://apr.js.org#${paramCase(name)}`,
        bugs: apr.bugs,
        people: apr.people,
        author: apr.author,
        contributors: apr.contributors,
        repository: 'ramitos/apr',
        directories: pkg.directories,
        files: ['files'],