How to use the jsdoc-to-markdown.render function in jsdoc-to-markdown

To help you get started, we’ve selected a few jsdoc-to-markdown 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 pattern-lab / patternlab-node / packages / core / scripts / docs.js View on Github external
//   .then(x => {
//     console.log(x);
//   });

doc
  .render({
    'example-lang': 'javascript',
    files: path.resolve(process.cwd(), './core/index.js'),
    'name-format': 'backticks',
    template: fs.readFileSync('./scripts/api.handlebars', 'utf8'),
  })
  .then(x => {
    fs.outputFile(path.resolve(process.cwd(), './docs/README.md'), x);
  });

doc
  .render({
    'example-lang': 'javascript',
    files: path.resolve(process.cwd(), './core/lib/events.js'),
    'name-format': 'backticks',
    template: fs.readFileSync('./scripts/events.handlebars', 'utf8'),
  })
  .then(x => {
    fs.outputFile(path.resolve(process.cwd(), './docs/events.md'), x);
  });
github electron-userland / electron-builder / scripts / jsdoc2md.js View on Github external
sortOptions(pages)
  // sortAutoUpdate(pages)

  for (const page of pages) {
    const finalOptions = Object.assign({
      data: page.data,
      "property-list-format": page === pages[0] || page === pages[3] || page === pages[1] ? "list" : "table",
      "param-list-format": page === pages[1] ? "list" : "table",
    }, jsdoc2MdOptions)

    if (page === pages[0]) {
      finalOptions["heading-depth"] = 1
    }

    let content = await jsdoc2md.render(finalOptions)

    if (page.mainHeader != null && content.startsWith("## Modules")) {
      content = "## API" + content.substring("## Modules".length)
    }
    if (page.mainHeader != null) {
      content = "## API" + content.substring(content.indexOf("\n", content.indexOf("##")))
    }

    await writeDocFile(path.join(__dirname, "..", "docs", page.page), content)
  }
}
github vitalets / websocket-as-promised / scripts / docs.js View on Github external
async function insertApiDocs() {
  const apiDocs = await jsdoc2md.render(JSDOC_OPTIONS);
  const oldContent = fs.readFileSync(FILENAME, 'utf8');
  if (!REGEXP.test(oldContent)) {
    throw new Error(`Can not match ${FILENAME} with regexp: ${REGEXP}`);
  }
  const newContent = oldContent.replace(REGEXP, `$1${apiDocs}$3`);
  if (newContent !== oldContent) {
    fs.writeFileSync(FILENAME, newContent, 'utf8');
    console.log(`Changes written to ${FILENAME}`);
  } else {
    console.log(`No changes in ${FILENAME}`);
  }
}
github alexmingoia / virtual-dom-stringify / gulpfile.js View on Github external
gulp.task('docs', function () {
  var src = 'lib/*.js';
  var dest = 'README.md';
  var options = {
    template: 'lib/README_tpl.hbs'
  };

  jsdoc2md.render(src, options)
    .on('error', function(err){
      console.log(err);
    })
    .pipe(fs.createWriteStream(dest));
});
github holochain / n3h / tools / gen-docs.js View on Github external
typeof docListJson !== 'object' ||
    Object.keys(docListJson).length < 1
  ) {
    console.log('no docs listed for', dir)
    return
  }

  const projectDocDir = path.join(docDir, project)
  _assertDir(projectDocDir)

  const docKeys = Object.keys(docListJson)
  docKeys.sort()
  for (let docName of docKeys) {
    const docPath = path.join(dir, docListJson[docName])
    console.log('generate docs for', docName, docPath)
    const md = await jsdoc2md.render({ files: docPath })

    fs.writeFileSync(path.join(projectDocDir, docName + '.md'), md)

    doclist += '- [' + docName + '](' + project + '/' + docName + '.md)\n'
  }

  return doclist
}
github flickr / flickr-sdk / script / build-docs.js View on Github external
var package = require('../package');
var jsdoc = require('jsdoc-to-markdown');
var ejs = require('ejs');

jsdoc.render({
	files: [
		'index.js',
		'services/rest.js',
		'services/oauth.js',
		'services/upload.js',
		'services/replace.js',
		'services/feeds.js'
	],
	'no-cache': true
}).then(function (docs) {

	return new Promise(function (resolve, reject) {
		ejs.renderFile(__dirname + '/build-docs.ejs', {
			package: package,
			docs: docs
		}, function (err, str) {
github jsdoc2md / grunt-jsdoc-to-markdown / tasks / jsdoc2md.js View on Github external
const promises = this.files.map(function (file) {
      const outputPath = file.dest
      grunt.file.mkdir(path.dirname(outputPath))
      options.files = file.src
      grunt.log.oklns('writing ' + outputPath)
      return jsdoc2md.render(options)
        .then(function (output) {
          fs.writeFileSync(outputPath, output)
        })
        .catch(grunt.fail.fatal)
    })
github redux-orm / redux-orm / tasks / api-docs / build.js View on Github external
async function toMarkdown(file) {
        const data = await jsdoc2md.getTemplateData({ configure, files: file });
        const markdown = await jsdoc2md.render({
            data,
            configure,
            template: template.toString(),
            partial,
            helper,
            ...dmdOpts,
        });

        const outputPath = file =>
            path.resolve(dest, path.basename(file).replace(/\.js$/, ".md"));

        return writeFile(outputPath(file), markdown);
    }
github ABWalters / react-api-hooks / generate-reference.js View on Github external
function generateReferenceDoc(inputFl, outputFl) {
  jsdoc2md
    .render({
      files: inputFl,
      template: `{{>all-docs~}}`
    })
    .then(markdown => {
      fs.writeFileSync(outputFl, markdown);
    });
}
github AgoraIO / Electron-SDK / scripts / jsapi.js View on Github external
const fs = require('fs');
const jsdoc2md = require('jsdoc-to-markdown');
const path = require('path')

let jsdoc = fs.createWriteStream(
  path.resolve(__dirname, '../docs/apis.md')
);

jsdoc2md.render({ 
  files: path.resolve(__dirname, '../js/Api/index.js') 
}).then(res => {
  jsdoc.write(res)
})

jsdoc-to-markdown

Generates markdown API documentation from jsdoc annotated source code

MIT
Latest version published 3 months ago

Package Health Score

64 / 100
Full package analysis