markdown-documentation-generator
Advanced tools
Comparing version 2.4.0 to 2.4.1
67
index.js
@@ -61,5 +61,2 @@ #!/usr/bin/env node | ||
//Set up identifiers | ||
_sg.uniqueIdentifier = 'md-sg'; | ||
//Argument methods | ||
@@ -142,2 +139,3 @@ const arg = { | ||
* Merge custom options with default options. | ||
* Resolves paths and makes sure they're output in a relative format. | ||
* | ||
@@ -186,4 +184,6 @@ * @param {Object} customOptions - user-provided options | ||
* Read configuration | ||
* | ||
* @param {Object} customOptions - user-provided options | ||
* @return {Object} - Merged user and default options | ||
*/ | ||
function registerConfig(customOptions) { | ||
@@ -193,2 +193,3 @@ | ||
listFiles(_sg.brand('Configuration')); | ||
//Read passed object or .styleguide file | ||
customOptions = customOptions || fs.readJSONSync('.styleguide', 'utf8'); | ||
@@ -268,3 +269,3 @@ } | ||
if (_.isUndefined(currentSection)){ | ||
//Use the "default" section (the one using no pattern match) | ||
//Use the "default" section (the section without a pattern match) | ||
currentSection = _.invert(options.sections)['']; | ||
@@ -306,2 +307,8 @@ sectionIdentifier = ''; | ||
//Grab the filelocation and store it | ||
$article(tags.file).each(function () { | ||
articleData.filelocation = $article(this).text().trim(); | ||
}).remove(); | ||
$article(tags.section).each(function () { | ||
@@ -314,3 +321,3 @@ articleData.currentSection = $article(this).text().trim(); | ||
console.info(_sg.logPre + _sg.warn("Warning: '" + chalk.bold(articleData.currentSection) + | ||
"' is not a registered section in your configuration.")); | ||
"' is not a registered section in your configuration. (" + articleData.filelocation + ")")); | ||
sectionIdentifier = ''; | ||
@@ -324,5 +331,8 @@ } | ||
if (articleData.category === '') { | ||
articleData.category = $article(this).text() | ||
articleData.category = $article(this) | ||
.text() | ||
.replace(/^\s+|\s+$/g, '') | ||
.replace(sectionIdentifier, '').trim(); | ||
.replace(sectionIdentifier, '') | ||
.trim(); | ||
$article(this).remove(); | ||
@@ -352,8 +362,2 @@ } | ||
//Grab the filelocation and store it | ||
$article(tags.file).each(function () { | ||
articleData.filelocation = $article(this).text().trim(); | ||
}).remove(); | ||
//Grab priority tag data and convert them to meaningful values | ||
@@ -418,3 +422,2 @@ $article(tags.priority).each(function() { | ||
sectionIdentifier = sectionInfo[1]; | ||
} | ||
@@ -438,4 +441,6 @@ else if (previousArticle !== undefined) { | ||
//Move category data to master | ||
return checkData(articleData); | ||
//Move and place article data into master | ||
articleData = checkData(articleData); | ||
return articleData; | ||
}); | ||
@@ -462,3 +467,3 @@ | ||
//If the section's ID has already been cached, | ||
// just append its data to the previous object | ||
//append its data to the previous object | ||
if (idCache.hasOwnProperty(articleData.id)) { | ||
@@ -478,6 +483,9 @@ | ||
} | ||
if (articleData.code.length > 0 ) { | ||
if (articleData.code.length > 0) { | ||
selectedSection.code = _.union(selectedSection.code, articleData.code); | ||
} | ||
//Set previous article so we can refer back if necessary | ||
previousArticle = selectedSection; | ||
return; | ||
@@ -499,7 +507,8 @@ } | ||
//Set previous article so we can refer back if necessary | ||
previousArticle = articleData; | ||
//Append new section to master data | ||
sanitize.objectPush(masterData.sections[currentSection], articleData); | ||
previousArticle = articleData; | ||
} | ||
@@ -523,3 +532,3 @@ } | ||
//Sort Sections | ||
Object.keys(data.sections).forEach(function(category){ | ||
Object.keys(data.sections).forEach(function(category) { | ||
data.sections[category] = sorting(data.sections[category]); | ||
@@ -572,3 +581,3 @@ }); | ||
//Create menu and section JSON | ||
Object.keys(options.sections).forEach(function(section){ | ||
Object.keys(options.sections).forEach(function(section) { | ||
data.menus[section] = formatSections(section, true); | ||
@@ -610,3 +619,3 @@ data.sections[section] = formatSections(section, false); | ||
*/ | ||
function readSGFile(fileExtension, root, name, fileContents) { | ||
function readSGFile(fileExtension, root, name, fileContents, callback) { | ||
@@ -631,2 +640,4 @@ fs.readFile(path.join(root, name), 'utf8', function (err, content) { | ||
} | ||
callback(); | ||
}); | ||
@@ -701,7 +712,6 @@ } | ||
walker.on("file", function (root, fileStats, next) { | ||
let fileExtension = fileStats.name.substr((~-fileStats.name.lastIndexOf(".") >>> 0) + 2).toLowerCase(); | ||
const fileExtension = fileStats.name.substr((~-fileStats.name.lastIndexOf(".") >>> 0) + 2).toLowerCase(); | ||
if (options.fileExtensions[fileExtension]) { | ||
readSGFile(fileExtension, root, fileStats.name, fileContents); | ||
next(); | ||
readSGFile(fileExtension, root, fileStats.name, fileContents, next); | ||
} | ||
@@ -728,6 +738,5 @@ else { | ||
'\n * If you\'re using the default settings, try using the "init" argument.'+ | ||
'\n If you\'re still receiving this error, please check the documentation or file an issue at '+ | ||
'\n If you\'re still receiving this error, please check the documentation or file an issue at: \n'+ | ||
chalk.blue.bold('github.com/UWHealth/markdown-documentation-generator/') | ||
); | ||
return false; | ||
} | ||
@@ -734,0 +743,0 @@ |
@@ -9,2 +9,3 @@ /* jshint node: true */ | ||
module.exports = { | ||
uniqueIdentifier: "md-sg", | ||
error: chalk.red, | ||
@@ -11,0 +12,0 @@ good: chalk.green, |
@@ -61,2 +61,3 @@ /* jshint node: true */ | ||
var processedText = ''; | ||
const langPrefix = options.markedOptions.langPrefix || " "; | ||
@@ -73,3 +74,3 @@ if (lang) { | ||
'<code class="hljs sg-code '+ | ||
options.markedOptions.langPrefix+'">' + | ||
langPrefix+'">' + | ||
processedText + | ||
@@ -76,0 +77,0 @@ '\n</code></pre>'+ |
@@ -191,3 +191,2 @@ /* jshint node: true */ | ||
sanitize.path = function(from, to){ | ||
@@ -194,0 +193,0 @@ return path.relative(from, path.join(__dirname, '../', to)); |
{ | ||
"name": "markdown-documentation-generator", | ||
"version": "2.4.0", | ||
"version": "2.4.1", | ||
"description": "Searches files for markdown and generates a static style/documentation guide. A fork of markdown-styleguide-generator.", | ||
@@ -36,3 +36,3 @@ "main": "index.js", | ||
"cheerio": "^0.20.0", | ||
"fs-extra": "^0.30.0", | ||
"fs-extra": "^3.0.1", | ||
"handlebars": "^4.0.0", | ||
@@ -51,7 +51,3 @@ "highlight.js": "^9.5.0", | ||
}, | ||
"readmeFilename": "README.md", | ||
"gitHead": "058fe1fab36c2957cff03ea43d896ec7f47acddf", | ||
"_id": "markdown-documentation-generator@1.3.0", | ||
"_shasum": "3803bbd214de1ddbbb8e1c1c9fac54ce79711d7a", | ||
"_from": "markdown-documentation-generator@>=1.2.0 <2.0.0" | ||
"readmeFilename": "README.md" | ||
} |
# markdown-documentation-generator | ||
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/bb0cc50ea95f47cfba2ccece0ef73cbb)](https://www.codacy.com/app/cleecanth/markdown-documentation-generator?utm_source=github.com&utm_medium=referral&utm_content=UWHealth/markdown-documentation-generator&utm_campaign=Badge_Grade) | ||
### Screenshot | ||
@@ -4,0 +6,0 @@ ![Screenshot](https://raw.githubusercontent.com/UWHealth/markdown-documentation-generator/master/docs/screenshot-example.jpg) |
@@ -26,5 +26,6 @@ // "use strict"; | ||
var nodemon = require('nodemon'); | ||
var config = require('../nodemon-watch.js'); | ||
nodemon('../../index.js lf').on('exit', function(){ | ||
process.exit(0); | ||
nodemon(config, "ls").on('log', function(event) { | ||
console.log(event.colour); | ||
}); |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
1124878
43
4076
397
0
+ Addedfs-extra@3.0.1(transitive)
+ Addedjsonfile@3.0.1(transitive)
+ Addeduniversalify@0.1.2(transitive)
- Removedbalanced-match@1.0.2(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removedfs-extra@0.30.0(transitive)
- Removedfs.realpath@1.0.0(transitive)
- Removedglob@7.2.3(transitive)
- Removedinflight@1.0.6(transitive)
- Removedjsonfile@2.4.0(transitive)
- Removedklaw@1.3.1(transitive)
- Removedminimatch@3.1.2(transitive)
- Removedonce@1.4.0(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedrimraf@2.7.1(transitive)
- Removedwrappy@1.0.2(transitive)
Updatedfs-extra@^3.0.1