<commit_before>'use strict';

var fs = require("fs"),
    path = require("path");

var docdown = require("../index.js");

// The input filename.
var file = process.argv[2];
file += /\.[a-z]+$/.test(file) ? '' : '.js';

// The output filename.
var output = process.argv[3] || path.basename(file);

/*----------------------------------------------------------------------------*/

var markdown = docdown({
  'path': path.join(process.cwd(), file),
  'title': 'Docdown <sup>v1.0.0</sup>',
  'url': 'https://github.com/jdalton/docdown/blob/master/index.js'
});

fs.writeFileSync(output + '.md', markdown);

console.log(markdown + '\n');<commit_msg>Make parse.js read package.json for the version number.<commit_after>'use strict';

var fs = require('fs'),
    path = require('path'),
    docdown = require('../index.js');

var packagePath = path.resolve(__dirname, '..', 'package.json'),
    packageText = fs.readFileSync(packagePath, 'utf-8'),
    packageJSON = JSON.parse(packageText);

var reExt = /\.[a-z]+$/;

// The version number from the package.json.
var version = packageJSON.version;

// The input filename.
var file = process.argv[2] + (reExt.test(process.argv[2]) ? '' : '.js');

// The output filename.
var output = process.argv[3] || (path.basename(file).replace(reExt, '') + '.md')

/*----------------------------------------------------------------------------*/

var markdown = docdown({
  'path': path.join(process.cwd(), file),
  'title': 'Docdown <sup>v' + version + '</sup>',
  'url': 'https://github.com/jdalton/docdown/tree/' + version + '/index.js'
});

fs.writeFileSync(output, markdown);

console.log(markdown + '\n');
{'fraction_non_alphanumeric': 0.29372333942717854, 'fraction_numerical': 0.005484460694698354, 'mean_word_length': 2.6008771929824563, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6219472', 'n_tokens_mistral': 529, 'n_tokens_neox': 525, 'n_words': 113}