Skip to content

Commit

Permalink
feat: Added generator text to content mappings.
Browse files Browse the repository at this point in the history
  • Loading branch information
tgreyuk committed Jan 14, 2024
1 parent 4c6fe80 commit 62f0eac
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/pages/options.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ Below is the full list of keys and default values:
"header.readme": "Readme",
"header.docs": "API",
"breadcrumbs.home": "{projectName}",
"footer.generator": "Generated using TypeDoc and typedoc-plugin-markdown.",
"title.indexPage": "{projectName} {version}",
"title.modulePage": "{name}",
"title.memberPage": "{kind}: {name}",
Expand Down
1 change: 1 addition & 0 deletions packages/typedoc-plugin-markdown/src/options/maps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export const StaticText = {
'header.readme': 'Readme',
'header.docs': 'API',
'breadcrumbs.home': '{projectName}',
'footer.generator': 'Generated using TypeDoc and typedoc-plugin-markdown.',
'title.indexPage': '{projectName} {version}',
'title.modulePage': '{name}',
'title.memberPage': '{kind}: {name}',
Expand Down
1 change: 1 addition & 0 deletions packages/typedoc-plugin-markdown/src/options/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export interface TextContentMappings {
'header.readme': string;
'header.docs': string;
'breadcrumbs.home': string;
'footer.generator': string;
'title.indexPage': string;
'title.modulePage': string;
'title.memberPage': string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@ import { horizontalRule } from '../../../support/elements';
*/
export function footer(context: MarkdownThemeRenderContext): string {
if (!context.options.getValue('hideGenerator')) {
return `${horizontalRule()}Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/)`;
const generatorText = context
.getTextContent('footer.generator')
?.replace(/TypeDoc/g, '[TypeDoc](https://typedoc.org)')
.replace(
/typedoc-plugin-markdown/g,
'[typedoc-plugin-markdown](https://typedoc-plugin-markdown.org)',
);
return [horizontalRule(), generatorText].join('');
}
return '';
}
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export const FIXTURES: Fixture[] = [
{
outDir: FixtureOutputDir.Text,
entryPoints: FixtureEntryPoints.Text,
commonOptions: { hideGenerator: true, disableSources: true },
commonOptions: { disableSources: true },
options: [
{
includeVersion: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ exports[`Text should get translations for index page: (Output File Strategy "mem
- [module-1](module-1/README.md)
- [module-2](module-2/README.md)
***
@copyright My Test
"
`;

Expand All @@ -34,6 +38,10 @@ exports[`Text should get translations for member page: (Output File Strategy "me
| Event! | Type |
| :------ | :------ |
| \`someEvent\` | \`MouseEvent\` |
***
@copyright My Test
"
`;

Expand All @@ -51,6 +59,10 @@ exports[`Text should get translations for module page: (Output File Strategy "me
### 多变的
- [SomeInterface](interfaces/SomeInterface.md)
***
@copyright My Test
"
`;

Expand All @@ -68,5 +80,9 @@ exports[`Text should get translations for modules page: (Output File Strategy "m
### Variable: constA
> **\`const\`** **constA**: \`true\` = \`true\`
***
@copyright My Test
"
`;
1 change: 1 addition & 0 deletions stubs/typedoc.text.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module.exports = {
'header.readme': 'My Readme',
'header.docs': 'Docs',
'breadcrumbs.home': 'Home',
'footer.generator': '@copyright My Test',
'title.indexPage': ':tada: Custom Index Title',
'title.memberPage': '{name}',
'title.member': '{kind}: {name}',
Expand Down

0 comments on commit 62f0eac

Please sign in to comment.