How to use the dox.parseComments function in dox

To help you get started, we’ve selected a few dox 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 metarhia / do / bin / mkdoc.js View on Github external
'use strict';

const dox = require('dox');
const fs = require('fs');

const code = fs.readFileSync(__dirname + '/../index.js').toString('utf8');
const ast = dox.parseComments(code, { raw: true });

let apiDoc = dox.api(ast);

// Don't like the new format Do.method
apiDoc = apiDoc
  .replace(/Do\./g, 'Do#')
  .replace('##', '###')
  .trim();

const tpl = fs.readFileSync(__dirname + '/readme.tpl', 'utf8');
const readme = tpl.replace('{api}', apiDoc);
fs.writeFileSync(__dirname + '/../readme.md', readme);

console.log('Written readme.md');
github DavidWells / markdown-magic / examples / generate-readme.js View on Github external
RENDERDOCS(content, options) {
      const fileContents = fs.readFileSync(options.path, 'utf8')
      const docBlocs = require('dox').parseComments(fileContents, { raw: true, skipSingleStar: true })
      let updatedContent = ''
      docBlocs.forEach((data) => {
        updatedContent += `${data.description.full}\n\n`
      })
      return updatedContent.replace(/^\s+|\s+$/g, '')
    },
    /* Match  */
github zuixjs / zuix / build / scripts / dox.js View on Github external
inputFiles.map((f, i)=>{
        const sourceFile = path.join(srcFolder, f);
        const code = fs.readFileSync(sourceFile, 'utf8');
        const jsonData = dox.parseComments(code, {raw: true});
        const targetFile = path.join(jsonApiFolder, path.basename(f+'on'));
        tlog.info('   ^w%s^:', targetFile);
        const targetFolder = path.dirname(targetFile);
        if (!fs.existsSync(targetFolder)) {
            fs.mkdirSync(targetFolder);
        }
        fs.writeFileSync(targetFile, JSON.stringify(jsonData));
    });
    // Generate ZUIX TypeScript Definition file
github mongodb / node-mongodb-native / dev / tools / docs.js View on Github external
exports.extractLibraryMetaData = function(sourceFiles) {
  var dataObjects = {};
  // Iterate over all source files
  for(var i = 0; i < sourceFiles.length; i++) {
    // Read source file content
    var sourceFile = fs.readFileSync(sourceFiles[i].path);
    // Parse the content
    var metaData = dox.parseComments(sourceFile.toString());
    // Save the metadata
    dataObjects[sourceFiles[i]["tag"] != null ? sourceFiles[i].tag : i] = metaData;
  }
  
  // Return all objects
  return dataObjects;
}
github remarkjs / remark-lint / script / util / rule.js View on Github external
function ruleSync(filePath) {
  var ruleId = path.basename(filePath)
  var result = {}
  var tests = {}
  var description
  var code
  var tags
  var name

  ruleId = ruleId.slice('remark-lint-'.length)
  code = fs.readFileSync(path.join(filePath, 'index.js'), 'utf-8')
  tags = dox.parseComments(code)[0].tags
  description = find(tags, 'fileoverview')
  name = find(tags, 'module')

  /* istanbul ignore if */
  if (name !== ruleId) {
    throw new Error(ruleId + ' has an invalid `@module`: ' + name)
  }

  /* istanbul ignore if */
  if (!description) {
    throw new Error(ruleId + ' is missing a `@fileoverview`')
  }

  description = strip(description)

  result.ruleId = ruleId
github Twipped / quell / docs / index.js View on Github external
var fs = require('fs');
var dox = require('dox');
var Handlebars = require('handlebars');

var template = Handlebars.compile(fs.readFileSync(__dirname + '/template.hbs.html').toString('utf8'));

var parsed = dox.parseComments(fs.readFileSync(__dirname + '/../lib/quell.js').toString('utf8'));

parsed = parsed.concat( dox.parseComments(fs.readFileSync(__dirname + '/../lib/types.js').toString('utf8')) );

var parents = {};
var parentless = {
	categories: {},
	uncategorized: []
};

parsed.forEach(function (item) {
	if (!item.ctx) {
		// If there's no context, then it's an extra chunk we don't care about
		item.ignore = true;
		return;
	}
github Twipped / quell / docs / index.js View on Github external
var fs = require('fs');
var dox = require('dox');
var Handlebars = require('handlebars');

var template = Handlebars.compile(fs.readFileSync(__dirname + '/template.hbs.html').toString('utf8'));

var parsed = dox.parseComments(fs.readFileSync(__dirname + '/../lib/quell.js').toString('utf8'));

parsed = parsed.concat( dox.parseComments(fs.readFileSync(__dirname + '/../lib/types.js').toString('utf8')) );

var parents = {};
var parentless = {
	categories: {},
	uncategorized: []
};

parsed.forEach(function (item) {
	if (!item.ctx) {
		// If there's no context, then it's an extra chunk we don't care about
		item.ignore = true;
		return;
	}

	item.signatures = [];
	item.aliases = [];
github Twipped / QueryizeJS / docs / index.js View on Github external
node.level = 3;
	}
}
changelog = (new commonmark.HtmlRenderer()).render(changelog);

/** Build Docs
*******************************************************************************************/

var parsed = dox.parseComments(
	fs.readFileSync(
		path.join(__dirname, '/../lib/queryize.js')
	).toString('utf8')
);

parsed = parsed.concat(
	dox.parseComments(
		fs.readFileSync(
			path.join(__dirname, '/../lib/mutators.js')
		).toString('utf8')
	)
);

var parents = {};
var parentless = {
	categories: {},
	uncategorized: []
};

parsed.forEach(function (item) {
	if (!item.ctx) {
		// If there's no context, then it's an extra chunk we don't care about
		item.ignore = true;
github tcql / turf-playground / makeExamples.js View on Github external
dirs.forEach(function(dir) {
    var path = base+"/"+dir;
    if (dir.indexOf('turf-') == -1 || !fs.statSync(path).isDirectory()) {
        return;
    }

    var contents = fs.readFileSync(path+"/index.js", 'utf-8');
    var comment = dox.parseComments(contents);
    var example = getExample(comment);
    if (example) {
        var parts = dir.split("-");
        var methodParts = parts.slice(1);
        for (var i = 1; i < methodParts.length; i++) {
            methodParts[i] = methodParts[i].charAt(0).toUpperCase() + methodParts[i].slice(1);
        }

        var func_name = parts[0] + "." + methodParts.join("");

        examples.push({
            name: dir,
            function_name: func_name,
            example: example,
            desc: marked(doxme(comment))
        });
github sequelize / sequelize / docs / docs-generator.js View on Github external
fs.readFile(file.file, function (err, code) {
        obj = dox.parseComments(code.toString(), { raw: true});
        path = program.out + '/' + file.output + '.md';

        console.log(path)

        var output = parseComments(obj, file.file);
        fs.writeFile(path, output);
      });
    });

dox

Markdown / JSdoc documentation generator

MIT
Latest version published 2 years ago

Package Health Score

51 / 100
Full package analysis

Popular dox functions