Skip to content

Commit

Permalink
fix docs generation
Browse files Browse the repository at this point in the history
  • Loading branch information
guidone committed Jun 13, 2022
1 parent 4550912 commit 3a5a44a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions bin/generate-docs.js
Expand Up @@ -3,7 +3,7 @@ var marked = require('marked');
var clc = require('cli-color');
var _ = require('underscore');
var fs = require('fs');
const { node } = require('../lib/helpers/lcd');

var green = clc.greenBright;
var white = clc.white;
var grey = clc.blackBright;
Expand Down Expand Up @@ -103,7 +103,7 @@ function collectImages(html) {
}

function fetchImageBase64(url) {
return new Promise(function(resolve, reject) {
return new Promise(function(resolve) {
// convert url to github raw
url = url.replace('github.com', 'raw.githubusercontent.com');
url = url.replace('/blob/', '/');
Expand Down Expand Up @@ -139,6 +139,7 @@ function fetchImagesBase64(images) {
}


// eslint-disable-next-line no-console
console.log(orange('Generating inline documentation...'));

_(mappings).map(function(nodeFiles, markdownFile) {
Expand All @@ -156,10 +157,11 @@ _(mappings).map(function(nodeFiles, markdownFile) {
} else {
nodeName = nodeFile.replace('.html', '');
}
// eslint-disable-next-line no-console
console.log('- ' + grey(markdownFile) + ' (' + nodeName + ')');

var markdownSource = fs.readFileSync(__dirname + '/../wiki/' + markdownFile, 'utf8');
var htmlSource = marked(markdownSource);
var htmlSource = marked.parse(markdownSource);
try {
var nodeSource = fs.readFileSync(__dirname + '/../nodes/' + nodeFile, 'utf8');
} catch(e) {
Expand Down Expand Up @@ -240,9 +242,11 @@ _(mappings).map(function(nodeFiles, markdownFile) {

tasks.then(
function() {
// eslint-disable-next-line no-console
console.log('Writing changelog ' + grey(__dirname + '/../CHANGELOG.md'));
var changelog = fs.readFileSync(__dirname + '/../wiki/Changelog.md', 'utf8');
fs.writeFileSync(__dirname + '/../CHANGELOG.md', changelog, 'utf8');
// eslint-disable-next-line no-console
console.log(green('All done.'));
},
function() {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -115,7 +115,7 @@
"express": "^4.17.1",
"fast-levenshtein": "^1.1.3",
"jszip": "^3.1.3",
"marked": "^0.3.6",
"marked": "^4.0.3",
"mime": "^1.3.4",
"mime-types": "^2.1.21",
"moment": "^2.13.0",
Expand Down

0 comments on commit 3a5a44a

Please sign in to comment.