Skip to content

Commit

Permalink
Allow inclusion of markdown from files
Browse files Browse the repository at this point in the history
  • Loading branch information
ledburyb committed Feb 9, 2022
1 parent 132f038 commit 8988442
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/lib/gruntConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ module.exports = function(grunt, options, spec) {
templates: {
files: [
options.specFile,
path.dirname(options.specFile) + '/**/*.md',
options.appDir + '/views/**/*.hbs',
options.appDir + '/helpers/**/*.js',
options.appDir + '/lib/**/*.js'
Expand Down
11 changes: 9 additions & 2 deletions app/lib/loadYaml.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
const fs = require('fs')
const yaml = require('js-yaml')
const p = require('path');
const yaml = require('js-yaml');


module.exports = function (path) {
const extendedSchema = yaml.DEFAULT_SCHEMA.extend({
explicit: [
new yaml.Type('!file', { kind: 'scalar', construct: function (relPath) { return fs.readFileSync(p.join(p.dirname(path), relPath), "utf8") }})
]
});
const fileContent = fs.readFileSync(path, "utf8")
return yaml.load(fileContent)
return yaml.load(fileContent, { schema: extendedSchema, filename: path })
}

0 comments on commit 8988442

Please sign in to comment.