Skip to content

Commit

Permalink
Make use of the option decoding code exposed by evaldown.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexjeffburke committed Aug 23, 2020
1 parent a0ee00a commit c95ae9d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
13 changes: 2 additions & 11 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,6 @@ async function copyDocumentationAssets(sourceDir, targetDir) {
}
}

async function decodeOptions(opts, cwd) {
if (opts.require) {
const modulePath = path.resolve(cwd, opts.require);
opts.filePreamble = await fs.readFile(modulePath, 'utf8');
opts.requirePath = path.dirname(modulePath);
}

return opts;
}

function idToName(id) {
return id.replace(/-/g, ' ');
}
Expand Down Expand Up @@ -145,9 +135,10 @@ module.exports = async function generate(options) {
config = null;
}
options = { ...config, ...options };
options = { ...options, ...(await Evaldown.decodeOptions(cwd, options)) };

const stats = await new Evaldown({
...(await decodeOptions(options, cwd)),
...options,
commentMarker: 'unexpected-markdown',
outputFormat: 'inlined',
sourcePath: documentation,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"autoprefixer": "9.8.6",
"debug": "4.1.0",
"ejs": "2.5.6",
"evaldown": "^1.0.0",
"evaldown": "^1.4.0",
"gh-pages": "2.0.1",
"glob": "7.1.6",
"lodash": "4.17.19",
Expand Down

0 comments on commit c95ae9d

Please sign in to comment.