Skip to content

Commit

Permalink
default includeExtension to true
Browse files Browse the repository at this point in the history
  • Loading branch information
tgreyuk committed Feb 18, 2022
1 parent 3e4eede commit bd1a3cd
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/docusaurus-plugin-typedoc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ Options specific to the plugin should also be declared in the same object.
| Name | Default | Description |
| :---------------------- | :------ | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `out` | `"api"` | Output dir relative to docs dir (use `.` for no subdir). |
| `includeExtension` | `false` | Determines whether to preserve the `.md` extension in relative links. `true` is recommended as per [Docusaurus documentation](https://docusaurus.io/docs/docs-markdown-features#referencing-other-documents) |
| `includeExtension` | `true` | Determines whether to preserve the `.md` extension in relative links. `true` is recommended as per [Docusaurus documentation](https://docusaurus.io/docs/docs-markdown-features#referencing-other-documents) |
| `sidebar.categoryLabel` | `API` | The sidebar parent category label. |
| `sidebar.fullNames` | `false` | Display full names with module path. |
| `sidebar.position` | `auto` | The position of the sidebar in the tree. |
Expand Down
2 changes: 1 addition & 1 deletion packages/docusaurus-plugin-typedoc/src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const DEFAULT_PLUGIN_OPTIONS: PluginOptions = {
entryDocument: 'index.md',
plugin: ['none'],
watch: false,
includeExtension: false,
includeExtension: true,
indexSlug: undefined,
theme: 'docusaurus',
};
Expand Down
4 changes: 2 additions & 2 deletions packages/docusaurus-plugin-typedoc/src/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class DocusaurusTheme extends MarkdownTheme {
indexSlug!: string;

@BindOption('includeExtension')
includeExtension!: boolean;
includeExtension!: string;

constructor(renderer: Renderer) {
super(renderer);
Expand All @@ -53,7 +53,7 @@ export class DocusaurusTheme extends MarkdownTheme {
}

getRelativeUrl(url: string) {
const re = new RegExp(this.includeExtension ? '' : '.md', 'g');
const re = new RegExp(this.includeExtension === 'true' ? '' : '.md', 'g');
const relativeUrl = super.getRelativeUrl(url).replace(re, '');
if (path.basename(relativeUrl).startsWith('index')) {
// always remove the extension for the index or else it creates weird paths like `../.md`
Expand Down

0 comments on commit bd1a3cd

Please sign in to comment.