Skip to content

Commit

Permalink
chore: Updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
tgreyuk committed Apr 19, 2024
1 parent e0450e2 commit e431c56
Show file tree
Hide file tree
Showing 10 changed files with 122 additions and 37 deletions.
13 changes: 8 additions & 5 deletions devtools/packages/helpers/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,31 +26,34 @@ export const DOCS_CONFIG: Record<string, DocsConfig> = {
},
['typedoc-github-wiki-theme']: {
declarationsPath: `${process.cwd()}/src/options/declarations.ts`,
presetsPath: `${process.cwd()}/src/options/presets.ts`,
optionsPath: 'plugins/github-wiki',
docsPath: '/plugins/github-wiki',
declarations: true,
presets: false,
presets: true,
},
['typedoc-gitlab-wiki-theme']: {
declarationsPath: `${process.cwd()}/src/options/declarations.ts`,
presetsPath: `${process.cwd()}/src/options/presets.ts`,
optionsPath: 'plugins/gitlab-wiki',
docsPath: '/plugins/gitlab-wiki',
declarations: true,
presets: false,
presets: true,
},
['typedoc-vitepress-theme']: {
declarationsPath: `${process.cwd()}/src/options/declarations.ts`,
presetsPath: `${process.cwd()}/src/options/presets.ts`,
optionsPath: 'plugins/vitepress',
docsPath: '/plugins/vitepress',
declarations: true,
presets: false,
presets: true,
},
['docusaurus-plugin-typedoc']: {
declarationsPath: `${process.cwd()}/src/options/declarations.ts`,
presetsPath: `${process.cwd()}/src/opions/presets.ts`,
presetsPath: `${process.cwd()}/src/options/presets.ts`,
optionsPath: '/plugins/docusaurus',
docsPath: '/plugins/docusaurus',
declarations: true,
presets: false,
presets: true,
},
};
5 changes: 0 additions & 5 deletions devtools/packages/prebuild-options/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { DOCS_CONFIG, DocsConfig, getPackageName } from '@devtools/helpers';
import { consola } from 'consola';
import { generateOptionsDocs } from './tasks/generate-docs';
import { generateOptionsModels } from './tasks/generate-models';
import { generateOptionsPresets } from './tasks/generate-presets';

main();

Expand All @@ -16,9 +15,5 @@ async function main() {
await generateOptionsDocs(docsConfig);
}

if (docsConfig.presets) {
await generateOptionsPresets(docsConfig);
}

consola.success(`[${getPackageName()}] Prebuild options complete`);
}
19 changes: 18 additions & 1 deletion devtools/packages/prebuild-options/tasks/generate-docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export async function generateOptionsDocs(docsConfig: DocsConfig) {
const out: string[] = [
`import { Callout, FileTree } from 'nextra/components';`,
];

out.push('# Options');
if (docsConfig.docsPath === '/docs') {
out.push(
Expand All @@ -26,6 +27,21 @@ export async function generateOptionsDocs(docsConfig: DocsConfig) {
);
}

if (docsConfig.presets) {
out.push('## Preset Options');
out.push('The following are preset typedoc-plugin-markdown options:');
const presetsConfig: any = await import(docsConfig.presetsPath as string);
const config = presetsConfig.default;
delete config.plugin;
const presetsJson = JSON.stringify(config, null, 2);

out.push(`\`\`\`json"
${presetsJson}
\`\`\``);
out.push('## Plugin Options');
out.push('The following options are exposed by this plugin:');
}

// DECLARATIONS
if (docsConfig.declarations) {
const declarationsConfig: any = await import(
Expand Down Expand Up @@ -92,7 +108,8 @@ export async function generateOptionsDocs(docsConfig: DocsConfig) {
const categories = Object.entries(groupedConfig);

categories.forEach(([categoryName, options]) => {
const optionLevel = categories.length === 1 ? '##' : '###';
const optionLevel =
categories.length === 1 && !Boolean(docsConfig.presets) ? '##' : '###';
if (categories.length > 1) {
out.push(`## ${getDocsTitle(categoryName)}`);
}
Expand Down
4 changes: 2 additions & 2 deletions docs/components/package-description.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ export const PackageDescription = ({ pjson }) => {

return (
<div>
<span className="inline-flex items-center rounded-md bg-gray-50 px-2 py-1 mt-3 text-sm font-medium text-gray-600 ring-1 ring-inset ring-gray-500/10">
{pjson.version}
<span className="inline-flex items-center rounded-md bg-gray-100 px-2 py-1 mt-3 text-sm font-medium text-gray-600 ring-1 ring-inset ring-gray-500/10">
v{pjson.version}
</span>
<Callout type="info">{pjson.description}</Callout>
</div>
Expand Down
19 changes: 18 additions & 1 deletion docs/pages/plugins/docusaurus/options.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,24 @@ import { Callout, FileTree } from 'nextra/components';
Please view options exposed by [typedoc-plugin-markdown](/docs/options) in addition to those listed here.
</Callout>

## sidebar
## Preset Options

The following are preset typedoc-plugin-markdown options:

```json"
{
"out": "./docs/api",
"hideBreadcrumbs": true,
"hidePageHeader": true,
"entryFileName": "index.md"
}
```

## Plugin Options

The following options are exposed by this plugin:

### sidebar

<Callout emoji="💡">Configures the autogenerated Docusaurus sidebar.</Callout>

Expand Down
26 changes: 25 additions & 1 deletion docs/pages/plugins/github-wiki.mdx
Original file line number Diff line number Diff line change
@@ -1,11 +1,35 @@
import pjson from '../../../packages/typedoc-github-wiki-theme/package.json';
import { Cards } from 'nextra/components';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faGithub } from '@fortawesome/free-brands-svg-icons';

# typedoc-github-wiki-theme

<PackageDescription pjson={pjson}></PackageDescription>
<PackageDescription pjson={pjson} />

## Features

- Generates Wiki friendly file names.
- Updates internal urls to a compatible format.
- Writes a `_Sidebar.md` file to display sidebar navigation.

## Example

The following is a simple example of a GithubWiki project running TypeDoc.

<Cards num={2}>
<Cards.Card
title="View Wiki on Github"
icon={<FontAwesomeIcon icon={faGithub} />}
arrow={true}
href="https://github.com/tgreyuk/typedoc-plugin-markdown-examples/wiki"
target="_blank"
/>
<Cards.Card
title="View Source on Github"
icon={<FontAwesomeIcon icon={faGithub} />}
arrow={true}
href="https://github.com/tgreyuk/typedoc-plugin-markdown-examples/tree/main/examples/04-typedoc-github-wiki-theme"
target="_blank"
/>
</Cards>
18 changes: 17 additions & 1 deletion docs/pages/plugins/github-wiki/options.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,23 @@ import { Callout, FileTree } from 'nextra/components';
Please view options exposed by [typedoc-plugin-markdown](/docs/options) in addition to those listed here.
</Callout>

## sidebar
## Preset Options

The following are preset typedoc-plugin-markdown options:

```json"
{
"entryFileName": "Home.md",
"hidePageHeader": true,
"flattenOutputFiles": true
}
```

## Plugin Options

The following options are exposed by this plugin:

### sidebar

<Callout emoji="💡">Configures the autogenerated `_sidebar.md file`.</Callout>

Expand Down
17 changes: 16 additions & 1 deletion docs/pages/plugins/gitlab-wiki/options.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,22 @@ import { Callout, FileTree } from 'nextra/components';
Please view options exposed by [typedoc-plugin-markdown](/docs/options) in addition to those listed here.
</Callout>

## sidebar
## Preset Options

The following are preset typedoc-plugin-markdown options:

```json"
{
"entryFileName": "home.md",
"hidePageHeader": true
}
```

## Plugin Options

The following options are exposed by this plugin:

### sidebar

<Callout emoji="💡">Configures the autogenerated `_Sidebar.md file`.</Callout>

Expand Down
20 changes: 18 additions & 2 deletions docs/pages/plugins/vitepress/options.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,23 @@ import { Callout, FileTree } from 'nextra/components';
Please view options exposed by [typedoc-plugin-markdown](/docs/options) in addition to those listed here.
</Callout>

## docsRoot
## Preset Options

The following are preset typedoc-plugin-markdown options:

```json"
{
"hidePageHeader": true,
"entryFileName": "index.md",
"out": "./api"
}
```

## Plugin Options

The following options are exposed by this plugin:

### docsRoot

<Callout emoji="💡">The path to the VitePress project root.</Callout>

Expand Down Expand Up @@ -39,7 +55,7 @@ Requires the following config:

___

## sidebar
### sidebar

<Callout emoji="💡">Configures the autogenerated VitePress sidebar.</Callout>

Expand Down
18 changes: 0 additions & 18 deletions packages/typedoc-github-wiki-theme/src/options/models.ts

This file was deleted.

0 comments on commit e431c56

Please sign in to comment.