typedoc-plugin-frontmatter
Advanced tools
Comparing version
@@ -33,22 +33,6 @@ "use strict"; | ||
const events_1 = require("./events"); | ||
const options_1 = require("./options"); | ||
const tags_1 = require("./tags"); | ||
function load(app) { | ||
app.options.addDeclaration({ | ||
name: 'frontmatterGlobals', | ||
help: '[typedoc-plugin-frontmatter] Specify static variables to be added to all frontmatter.', | ||
type: typedoc_1.ParameterType.Mixed, | ||
defaultValue: {}, | ||
}); | ||
app.options.addDeclaration({ | ||
name: 'frontmatterTags', | ||
help: '[typedoc-plugin-frontmatter] Specify which file comment tags should be added to frontmatter.', | ||
type: typedoc_1.ParameterType.Array, | ||
defaultValue: [], | ||
}); | ||
app.options.addDeclaration({ | ||
name: 'frontmatterTagsToSnakeCase', | ||
help: '[typedoc-plugin-frontmatter] Jsdoc tags cannot be snake case. Tags by default must be camelCase', | ||
type: typedoc_1.ParameterType.Boolean, | ||
defaultValue: false, | ||
}); | ||
(0, options_1.declareOptions)(app); | ||
app.renderer.on(typedoc_1.PageEvent.END, (page) => { | ||
@@ -65,3 +49,5 @@ var _a, _b; | ||
app.renderer.trigger(event); | ||
page.contents = (_b = page === null || page === void 0 ? void 0 : page.contents) === null || _b === void 0 ? void 0 : _b.replace(/^/, `---\n${yaml.stringify(event.frontmatter)}---\n\n`).replace(/[\r\n]{3,}/g, '\n\n'); | ||
if (Object.keys(event.frontmatter).length) { | ||
page.contents = (_b = page === null || page === void 0 ? void 0 : page.contents) === null || _b === void 0 ? void 0 : _b.replace(/^/, `---\n${yaml.stringify(event.frontmatter)}---\n\n`).replace(/[\r\n]{3,}/g, '\n\n'); | ||
} | ||
}); | ||
@@ -68,0 +54,0 @@ } |
{ | ||
"name": "typedoc-plugin-frontmatter", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "A plugin for TypeDoc that prepends configurable frontmatter to page content.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
13412
3.65%11
22.22%146
9.77%