Skip to content

Commit

Permalink
Merge branch 'release/v1.5.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
joeworkman committed Jul 23, 2020
2 parents 71b54ca + 4e4d7b7 commit c48f407
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 11 deletions.
18 changes: 9 additions & 9 deletions lib/config.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
var extend = require('util')._extend;
var fs = require('fs');
var Renderer = require('marked').Renderer;
var fs = require('fs');
var marked = require('marked');

module.exports = function(opts) {
var fileData;

this.options = extend({
config: {},
data: {},
extension: 'html',
handlebars: require('handlebars'),
marked: new Renderer(),
pageRoot: process.cwd(),
silent: false
config : {},
data : {},
extension : 'html',
handlebars : require('handlebars'),
marked : new marked.Renderer(),
pageRoot : process.cwd(),
silent : false
}, opts);

// A template is required
Expand Down
11 changes: 10 additions & 1 deletion lib/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ var glob = require('glob');
var globAll = require('glob-all');
var marked = require('marked');
var path = require('path');
var hljs = require('highlight.js');

// Parses files according to the options passed to the constructor.
module.exports = function(file, opts, cb) {
Expand All @@ -28,8 +29,16 @@ module.exports = function(file, opts, cb) {

// Catch Markdown errors
if (this.options.marked) {
marked.setOptions({
renderer : this.options.marked,
highlight : (code, language) => {
const validLanguage = hljs.getLanguage(language) ? language : 'html';
return hljs.highlight(validLanguage, code).value;
}
});

try {
page.docs = marked(pageData.body, { renderer: _this.options.marked });
page.docs = marked(pageData.body);
}
catch (e) {
throw new Error('Marked error: ' + e.message);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "supercollider",
"version": "1.5.1",
"version": "1.5.2",
"description": "Documentation generator that can combine data from multiple parsers, such as SassDoc and JSDoc.",
"keywords": [
"documentation",
Expand Down

0 comments on commit c48f407

Please sign in to comment.