typedoc-plugin-frontmatter
Advanced tools
Comparing version
@@ -27,2 +27,3 @@ "use strict"; | ||
exports.load = void 0; | ||
const path = __importStar(require("path")); | ||
const typedoc_plugin_markdown_1 = require("typedoc-plugin-markdown"); | ||
@@ -40,3 +41,4 @@ const yaml = __importStar(require("yaml")); | ||
app.renderer.on(typedoc_plugin_markdown_1.MarkdownPageEvent.BEGIN, (page) => { | ||
var _a, _b, _c; | ||
var _a, _b, _c, _d; | ||
const entryFileName = app.options.getValue('entryFileName'); | ||
const frontmatterGlobals = app.options.getValue('frontmatterGlobals'); | ||
@@ -46,2 +48,4 @@ const frontmatterTags = app.options.getValue('frontmatterCommentTags'); | ||
const preserveFrontmatterCommentTags = app.options.getValue('preserveFrontmatterCommentTags'); | ||
const readmeFrontmatter = app.options.getValue('readmeFrontmatter'); | ||
const indexFrontmatter = app.options.getValue('indexFrontmatter'); | ||
const resolvedFrontmatterTags = ((_a = page.model) === null || _a === void 0 ? void 0 : _a.comment) | ||
@@ -62,2 +66,14 @@ ? (0, tags_1.getFrontmatterTags)((_b = page.model) === null || _b === void 0 ? void 0 : _b.comment, frontmatterTags, namingConvention) | ||
}; | ||
if (path.parse(page.url).name === path.parse(entryFileName).name) { | ||
page.frontmatter = { | ||
...page.frontmatter, | ||
...readmeFrontmatter, | ||
}; | ||
} | ||
if (path.parse(page.url).name === path.parse(((_d = page.project) === null || _d === void 0 ? void 0 : _d.url) || '').name) { | ||
page.frontmatter = { | ||
...page.frontmatter, | ||
...indexFrontmatter, | ||
}; | ||
} | ||
}); | ||
@@ -64,0 +80,0 @@ app.renderer.on(typedoc_plugin_markdown_1.MarkdownPageEvent.END, (page) => { |
import { DeclarationOption } from 'typedoc'; | ||
export declare const frontmatterGlobals: Partial<DeclarationOption>; | ||
export declare const readmeFrontmatter: Partial<DeclarationOption>; | ||
export declare const indexFrontmatter: Partial<DeclarationOption>; | ||
export declare const frontmatterCommentTags: Partial<DeclarationOption>; | ||
export declare const preserveFrontmatterCommentTags: Partial<DeclarationOption>; | ||
export declare const frontmatterNamingConvention: Partial<DeclarationOption>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.frontmatterNamingConvention = exports.preserveFrontmatterCommentTags = exports.frontmatterCommentTags = exports.frontmatterGlobals = void 0; | ||
exports.frontmatterNamingConvention = exports.preserveFrontmatterCommentTags = exports.frontmatterCommentTags = exports.indexFrontmatter = exports.readmeFrontmatter = exports.frontmatterGlobals = void 0; | ||
const typedoc_1 = require("typedoc"); | ||
@@ -11,2 +11,12 @@ const maps_1 = require("./maps"); | ||
}; | ||
exports.readmeFrontmatter = { | ||
help: 'Specify static variables to be added to the readme page only.', | ||
type: typedoc_1.ParameterType.Mixed, | ||
defaultValue: {}, | ||
}; | ||
exports.indexFrontmatter = { | ||
help: 'Specify static variables to be added to the index page only.', | ||
type: typedoc_1.ParameterType.Mixed, | ||
defaultValue: {}, | ||
}; | ||
exports.frontmatterCommentTags = { | ||
@@ -13,0 +23,0 @@ help: 'Specify which comment block tags should be added to frontmatter.', |
@@ -0,4 +1,5 @@ | ||
import { ManuallyValidatedOption } from 'typedoc'; | ||
declare module 'typedoc' { | ||
interface TypeDocOptionMap { | ||
frontmatterGlobals: any; | ||
frontmatterGlobals: ManuallyValidatedOption<FrontmatterGlobals>; | ||
frontmatterCommentTags: any[]; | ||
@@ -10,3 +11,3 @@ preserveFrontmatterCommentTags: boolean; | ||
export interface PluginOptions { | ||
frontmatterGlobals: any; | ||
frontmatterGlobals: ManuallyValidatedOption<FrontmatterGlobals>; | ||
frontmatterCommentTags: any[]; | ||
@@ -16,1 +17,3 @@ preserveFrontmatterCommentTags: boolean; | ||
} | ||
export interface FrontmatterGlobals { | ||
} |
{ | ||
"name": "typedoc-plugin-frontmatter", | ||
"version": "0.0.3-next.0", | ||
"version": "1.0.0-next.1", | ||
"description": "A plugin for TypeDoc that prepends configurable frontmatter to page content.", | ||
@@ -16,3 +16,4 @@ "main": "dist/index.js", | ||
"pretest": "ts-node ./test/__scripts__/prepare.ts", | ||
"test": "jest" | ||
"test": "jest", | ||
"test:update": "npm run build && npm run test -- -u" | ||
}, | ||
@@ -29,13 +30,14 @@ "author": "Tom Grey", | ||
}, | ||
"homepage": "https://github.com/tgreyuk/typedoc-plugin-markdown/tree/master/packages/typedoc-plugin-frontmatter#readme", | ||
"homepage": "https://typedoc-plugin-markdown.org/utilities/frontmatter/introduction", | ||
"dependencies": { | ||
"yaml": "^2.2.2" | ||
"yaml": "^2.3.4" | ||
}, | ||
"peerDependencies": { | ||
"typedoc-plugin-markdown": ">=4.0.0-next.13" | ||
"typedoc-plugin-markdown": ">=4.0.0-next.54" | ||
}, | ||
"keywords": [ | ||
"frontmatter", | ||
"typedoc" | ||
"typedoc", | ||
"typedoc-plugin" | ||
] | ||
} |
# typedoc-plugin-frontmatter | ||
  [](https://github.com/tgreyuk/typedoc-plugin-markdown/actions/workflows/ci.yml) | ||
 [](https://github.com/tgreyuk/typedoc-plugin-markdown/actions/workflows/ci.yml) | ||
@@ -15,6 +15,2 @@ A plugin for TypeDoc that prepends configurable frontmatter to page content. | ||
Please visit https://typedoc-plugin-markdown.org/utilities/frontmatter. | ||
## License | ||
Released under the [MIT License](./LICENSE). | ||
Please visit [typedoc-plugin-markdown.org](https://typedoc-plugin-markdown.org/utilities/frontmatter/introduction) for comprehensive documentation, including options and usage guides. |
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
13110
23.88%15
15.38%229
33.92%0
-100%2
100%15
-21.05%+ Added
- Removed
Updated