Skip to content

Commit

Permalink
fix: Tweaked escape character methods and updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
tgreyuk committed Apr 9, 2024
1 parent 5cf93c2 commit 2cc4160
Show file tree
Hide file tree
Showing 70 changed files with 866 additions and 977 deletions.
8 changes: 6 additions & 2 deletions devtools/packages/prebuild-options/tasks/generate-models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ export async function generateModels(declarationsPath: string) {
(option as any).defaultValue,
);

const sortedOptionsConfig = Object.fromEntries(
Object.entries(optionsConfig).sort((a, b) => a[0].localeCompare(b[0])),
);

const optionsOutput = `
// THIS FILE IS AUTO GENERATED FROM THE OPTIONS CONFIG. DO NOT EDIT DIRECTLY.
Expand All @@ -31,7 +35,7 @@ export async function generateModels(declarationsPath: string) {
declare module 'typedoc' {
export interface TypeDocOptionMap {
${(Object.entries(optionsConfig) as any)
${(Object.entries(sortedOptionsConfig) as any)
.map(([name, option]) => `${name}: ${getType(name, option)};`)
.join('\n')}
}
Expand All @@ -43,7 +47,7 @@ export async function generateModels(declarationsPath: string) {
* @category Options
*/
export interface PluginOptions {
${(Object.entries(optionsConfig) as any)
${(Object.entries(sortedOptionsConfig) as any)
.map(
([name, option]) => `
/**
Expand Down
20 changes: 20 additions & 0 deletions devtools/scripts/generate-readmes.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
import { DOCS_CONFIG } from '@devtools/helpers';
import { consola } from 'consola';
import * as fs from 'fs';
import * as path from 'path';

main();
copyChangelog();

async function copyChangelog() {
const changelog = fs.readFileSync(
path.join(
__dirname,
'../../packages/typedoc-plugin-markdown/CHANGELOG_V4.md',
),
);
const readmeContents = changelog
.toString()
.replace(/^>(.*)$/gm, '<Callout>$1</Callout>')
.replace(/<!--[\s\S]*?-->/g, '');

fs.writeFileSync(
path.join(__dirname, '../../docs/pages/docs/changelog.mdx'),
`import { Callout } from 'nextra/components';\n\n` + readmeContents,
);
}

async function main() {
const packagesPromises = [
Expand Down
10 changes: 5 additions & 5 deletions docs/pages/api-docs/Class.MarkdownPageEvent.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ The project the renderer is currently processing.

### model

> **`readonly`** **model**: `Model`
> `readonly` **model**: `Model`
The model that should be rendered on this page.

Expand All @@ -52,7 +52,7 @@ The filename the page will be written to.

### contents?

> **`optional`** **contents**: `string`
> `optional` **contents**: `string`
The final markdown content of this page.

Expand All @@ -62,22 +62,22 @@ Should be rendered by layout templates and can be modified by plugins.

### frontmatter?

> **`optional`** **frontmatter**: `Record`\<`string`, `any`\>
> `optional` **frontmatter**: `Record`\<`string`, `any`\>
The frontmatter of this page represented as a key value object. This property can be utilised by other plugins.

## Events

### BEGIN

> **`static`** **`readonly`** **BEGIN**: `"beginPage"` = `'beginPage'`
> `static` `readonly` **BEGIN**: `"beginPage"` = `'beginPage'`
Triggered before a document will be rendered.

***

### END

> **`static`** **`readonly`** **END**: `"endPage"` = `'endPage'`
> `static` `readonly` **END**: `"endPage"` = `'endPage'`
Triggered after a document has been rendered, just before it is written to disc.
12 changes: 6 additions & 6 deletions docs/pages/api-docs/Class.MarkdownRendererEvent.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,46 +18,46 @@ app.renderer.on(MarkdownRendererEvent.BEGIN, (event) => {

### project

> **`readonly`** **project**: [`ProjectReflection`](https://typedoc.org/api/classes/Models.ProjectReflection.html)
> `readonly` **project**: [`ProjectReflection`](https://typedoc.org/api/classes/Models.ProjectReflection.html)
The project the renderer is currently processing.

***

### outputDirectory

> **`readonly`** **outputDirectory**: `string`
> `readonly` **outputDirectory**: `string`
The path of the directory the documentation should be written to.

***

### urls?

> **`optional`** **urls**: [`UrlMapping`](/api-docs/Interface.UrlMapping.md)\<[`Reflection`](https://typedoc.org/api/classes/Models.Reflection.html)\>[]
> `optional` **urls**: [`UrlMapping`](/api-docs/Interface.UrlMapping.md)\<[`Reflection`](https://typedoc.org/api/classes/Models.Reflection.html)\>[]
A list of all pages that should be generated.

***

### navigation?

> **`optional`** **navigation**: [`NavigationItem`](/api-docs/Interface.NavigationItem.md)[]
> `optional` **navigation**: [`NavigationItem`](/api-docs/Interface.NavigationItem.md)[]
The navigation structure of the project that can be utilised by plugins.

## Events

### BEGIN

> **`static`** **`readonly`** **BEGIN**: `"beginRender"` = `'beginRender'`
> `static` `readonly` **BEGIN**: `"beginRender"` = `'beginRender'`
Triggered before the renderer starts rendering a project.

***

### END

> **`static`** **`readonly`** **END**: `"endRender"` = `'endRender'`
> `static` `readonly` **END**: `"endRender"` = `'endRender'`
Triggered after the renderer has written all documents.
15 changes: 8 additions & 7 deletions docs/pages/api-docs/Class.MarkdownThemeRenderContext.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,31 +42,31 @@ Use my new helper - ${this.helpers.newHelper()}

### page

> **`readonly`** **page**: [`MarkdownPageEvent`](/api-docs/Class.MarkdownPageEvent.md)\<[`Reflection`](https://typedoc.org/api/classes/Models.Reflection.html)\>
> `readonly` **page**: [`MarkdownPageEvent`](/api-docs/Class.MarkdownPageEvent.md)\<[`Reflection`](https://typedoc.org/api/classes/Models.Reflection.html)\>
The current page event.

***

### options

> **`readonly`** **options**: [`Options`](https://typedoc.org/api/classes/Configuration.Options.html)
> `readonly` **options**: [`Options`](https://typedoc.org/api/classes/Configuration.Options.html)
The options provided to the application.

***

### textContentMappings

> **`readonly`** **textContentMappings**: `Partial`\<[`TextContentMappings`](/api-docs/Interface.TextContentMappings.md)\>
> `readonly` **textContentMappings**: `Partial`\<[`TextContentMappings`](/api-docs/Interface.TextContentMappings.md)\>
Holds the textmappings object of the theme.

***

### packagesMetaData

> **`readonly`** **packagesMetaData**: `Record`\<`string`, `object`\>
> `readonly` **packagesMetaData**: `Record`\<`string`, `object`\>
Holds meta data for individual packages (if entryPointStrategy equals `packages`).

Expand Down Expand Up @@ -708,6 +708,7 @@ Renders a signature member.
| `options.headingLevel`? | `number` |
| `options.showSummary`? | `boolean` |
| `options.showTags`? | `boolean` |
| `options.isTableColumn`? | `boolean` |

###### Returns

Expand Down Expand Up @@ -915,15 +916,15 @@ Renders a signature member.

##### someType()

> **someType**: (`model`: `SomeType`) => `string`
> **someType**: (`model`?: `SomeType`) => `string`
Takes a generic Type and returns the appropriate partial for it.

###### Parameters

| Parameter | Type |
| :------ | :------ |
| `model` | `SomeType` |
| `model`? | `SomeType` |

###### Returns

Expand Down Expand Up @@ -1088,7 +1089,7 @@ Helpers can return any value types.
###### description?

> **`optional`** **description**: `string`
> `optional` **description**: `string`
#### getParameterDefaultValue()

Expand Down
4 changes: 2 additions & 2 deletions docs/pages/api-docs/Interface.NavigationItem.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ The model used to define the navigation structure.

### url?

> **`optional`** **url**: `null` \| `string`
> `optional` **url**: `null` \| `string`
***

### children?

> **`optional`** **children**: [`NavigationItem`](/api-docs/Interface.NavigationItem.md)[]
> `optional` **children**: [`NavigationItem`](/api-docs/Interface.NavigationItem.md)[]

0 comments on commit 2cc4160

Please sign in to comment.