Skip to content

Commit

Permalink
feat(core): write .nojekyll file if TypeDocs "githubPages" option i…
Browse files Browse the repository at this point in the history
…s true (#650)
  • Loading branch information
tgreyuk committed Jul 10, 2024
1 parent c366490 commit d8b983d
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/nice-rabbits-yell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'typedoc-plugin-markdown': patch
---

- Write `.nojekyll` file if TypeDocs "githubPages" option is true (#650)
4 changes: 3 additions & 1 deletion docs/pages/docs/typedoc-usage.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ Below is a list of which TypeDoc Output options are supported or not:
- `--theme` Yes ✅ (theme should be MarkdownTheme instance)
- `--cleanOutputDir` Yes ✅
- `--basePath` Yes ✅
- `--lang` Yes ✅
- `--locale` Yes ✅
- `--githubPages` Yes ✅ (defaults to `false`)
- `--hideParameterTypesInTitle` No ❌ (use <OptionLink type="display" name="expandParameters" />)
- `--navigation` No ❌ (use <OptionLink type="utility" name="navigationModel" />)
- `--titleLink` No ❌
Expand All @@ -42,7 +45,6 @@ Below is a list of which TypeDoc Output options are supported or not:
- `--cname` No ❌
- `--sourceLinkExternal` No ❌
- `--htmlLang` No ❌
- `--githubPages` No ❌
- `--cacheBust` No ❌
- `--gaID` No ❌
- `--hideGenerator` No ❌
Expand Down
15 changes: 15 additions & 0 deletions packages/typedoc-plugin-markdown/src/renderer/overrides.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,21 @@ export async function render(
return;
}

if (
this.application.options.isSet('githubPages') &&
this.application.options.getValue('githubPages') === true
) {
try {
fs.writeFileSync(path.join(outputDirectory, '.nojekyll'), '');
} catch (error) {
this.application.logger.warn(
this.application.i18n.could_not_write_0(
path.join(outputDirectory, '.nojekyll'),
),
);
}
}

this.prepareTheme();

const output = new MarkdownRendererEvent(
Expand Down
3 changes: 2 additions & 1 deletion packages/typedoc-plugin-markdown/test/fixtures/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,11 @@ const config: Record<string, Fixture> = {
name: '@scope/entryfile',
},
options: [
{ entryFileName: 'README.md' },
{ entryFileName: 'README.md', githubPages: true },
{
readme: 'none',
excludeScopesInPaths: true,
githubPages: false,
},
],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ exports[`Urls should gets Urls for documents single module: outputFileStrategy:

exports[`Urls should gets Urls for entry module: outputFileStrategy: members 1`] = `
[
".nojekyll",
"@scope/module-1/README.mdx",
"@scope/module-1/classes/ModuleClass.mdx",
"README.mdx",
Expand All @@ -272,6 +273,7 @@ exports[`Urls should gets Urls for entry module: outputFileStrategy: members 2`]

exports[`Urls should gets Urls for entry module: outputFileStrategy: modules 1`] = `
[
".nojekyll",
"@scope/module-1.mdx",
"README.mdx",
"module-2.mdx",
Expand Down

0 comments on commit d8b983d

Please sign in to comment.