Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: typedoc plugins for third party symbols appear to be ignored #263

Closed
favna opened this issue Nov 6, 2021 · 5 comments
Closed

bug: typedoc plugins for third party symbols appear to be ignored #263

favna opened this issue Nov 6, 2021 · 5 comments

Comments

@favna
Copy link

favna commented Nov 6, 2021

Hello there, I tried adding 2 plugins that offer third part symbols (https://github.com/TypeStrong/typedoc/blob/master/internal-docs/third-party-symbols.md) to my docusaurus generated markdown docs, however, they are simply not made into links. The plugins however work fine when generating typedoc's own HTML.

The typedoc plugins I'm trying to use are: https://github.com/Gerrit0/typedoc-plugin-mdn-links and https://github.com/sapphiredev/typedoc-plugin-djs-links

One of the docusaurus usages of the docusaurus-plugin-typedoc is:

		[
			'docusaurus-plugin-typedoc',
			{
				id: 'framework',
				entryPoints: ['./projects/framework/src/index.ts'],
				tsconfig: './projects/framework/src/tsconfig.json',
				readme: 'none',
				out: 'Documentation/api-framework',
				plugin: ['typedoc-plugin-mdn-links', 'typedoc-plugin-djs-links'],
				excludeExternals: true,
				sidebar: {
					categoryLabel: '@sapphire/framework',
					position: 0,
					fullNames: true
				}
			}
		],

As an example, using this plugin I get the following:

image

Whereas that same function in the typedoc generated html looks like this:

image

As you can see, the Message symbol is a link here.

The matching markdown for the former is:

### resolveChannel**resolveChannel**(`parameter`, `message`): [`Result`](../#result)<`ChannelTypes`, [`ArgumentChannelError`](../enums/Identifiers#argumentchannelerror)\>

#### Parameters

| Name | Type |
| :------ | :------ |
| `parameter` | `string` |
| `message` | `Message`<`boolean`\> |

#### Returns

[`Result`](../#result)<`ChannelTypes`, [`ArgumentChannelError`](../enums/Identifiers#argumentchannelerror)\>

#### Defined in

[projects/framework/src/lib/resolvers/channel.ts:7](https://github.com/sapphiredev/framework/blob/d246d1af/src/lib/resolvers/channel.ts#L7)

So the expected result would look like so, note the added link at Message:

### resolveChannel**resolveChannel**(`parameter`, `message`): [`Result`](../#result)<`ChannelTypes`, [`ArgumentChannelError`](../enums/Identifiers#argumentchannelerror)\>

#### Parameters

| Name | Type |
| :------ | :------ |
| `parameter` | `string` |
| `message` | [`Message`](<https://discord.js.org/#/docs/main/stable/class/Message>)<`boolean`\> |

#### Returns

[`Result`](../#result)<`ChannelTypes`, [`ArgumentChannelError`](../enums/Identifiers#argumentchannelerror)\>

#### Defined in

[projects/framework/src/lib/resolvers/channel.ts:7](https://github.com/sapphiredev/framework/blob/d246d1af/src/lib/resolvers/channel.ts#L7)

A preview deploy that shows the image above is available on Vercel: https://website-git-feat-add-third-party-symbols-sapphiredev.vercel.app/docs/Documentation/api-framework/namespaces/Resolvers#resolvechannel
It is based on a branch on the repository where I'm using this plugin: https://github.com/sapphiredev/website/tree/feat/add-third-party-symbols (PR for branch: sapphiredev/website#85)

@tgreyuk
Copy link
Member

tgreyuk commented Nov 12, 2021

Thanks for detailed description. Fix in typedoc-plugin-markdown@3.11.4

Screenshot 2021-11-12 at 22 33 51

@favna
Copy link
Author

favna commented Nov 13, 2021

Hi there, I can confirm the feature is there, however it's not entirely working well just yet. Running docusaurus start works, but when trying to run docusaurus build which does broken link checking I get the following:

Error: Docusaurus found broken links!

Please check the pages of your site in the list below, and make sure you don't reference any path that does not exist.
Note: it's possible to ignore broken links with the 'onBrokenLinks' Docusaurus configuration, and let the build pass.

Exhaustive list of all broken links found:

- On source page path = /docs/Documentation/api-framework/classes/SapphireClient:
   -> linking to %5B%60GuildPreview%60%5D(https://discord.js.org/#/docs/main/stable/class/GuildPreview)%5C (resolved as: /docs/Documentation/api-framework/classes/%5B%60GuildPreview%60%5D(https://discord.js.org/)
   -> linking to %5B%60GuildTemplate%60%5D(https://discord.js.org/#/docs/main/stable/class/GuildTemplate)%5C (resolved as: /docs/Documentation/api-framework/classes/%5B%60GuildTemplate%60%5D(https://discord.js.org/)
   -> linking to %5B%60Widget%60%5D(https://discord.js.org/#/docs/main/stable/class/Widget)%5C (resolved as: /docs/Documentation/api-framework/classes/%5B%60Widget%60%5D(https://discord.js.org/)
   -> linking to %5B%60Invite%60%5D(https://discord.js.org/#/docs/main/stable/class/Invite)%5C (resolved as: /docs/Documentation/api-framework/classes/%5B%60Invite%60%5D(https://discord.js.org/)
   -> linking to %5B%60Sticker%60%5D(https://discord.js.org/#/docs/main/stable/class/Sticker)%5C (resolved as: /docs/Documentation/api-framework/classes/%5B%60Sticker%60%5D(https://discord.js.org/)
   -> linking to %5B%60Webhook%60%5D(https://discord.js.org/#/docs/main/stable/class/Webhook)%5C (resolved as: /docs/Documentation/api-framework/classes/%5B%60Webhook%60%5D(https://discord.js.org/)

- On source page path = /docs/Documentation/api-utilities/classes/sapphire_discord_js_utilities.LazyPaginatedMessage:
   -> linking to %5B%60MessageComponentInteraction%60%5D(https://discord.js.org/#/docs/main/stable/class/MessageComponentInteraction)%3C%60CacheType%60%5C (resolved as: /docs/Documentation/api-utilities/classes/%5B%60MessageComponentInteraction%60%5D(https://discord.js.org/)
   -> linking to %5B%60MessageEmbed%60%5D(https://discord.js.org/#/docs/main/stable/class/MessageEmbed)%5C (resolved as: /docs/Documentation/api-utilities/classes/%5B%60MessageEmbed%60%5D(https://discord.js.org/)
   -> linking to %5B%60MessageEmbed%60%5D(https://discord.js.org/#/docs/main/stable/class/MessageEmbed)%5B%5D%5C (resolved as: /docs/Documentation/api-utilities/classes/%5B%60MessageEmbed%60%5D(https://discord.js.org/)

- On source page path = /docs/Documentation/api-utilities/classes/sapphire_discord_js_utilities.MessagePrompterMessageStrategy:
   -> linking to %5B%5B%60Message%60%5D(https://discord.js.org/#/docs/main/stable/class/Message)%3C%60boolean%60%5C (resolved as: /docs/Documentation/api-utilities/classes/%5B%5B%60Message%60%5D(https://discord.js.org/)
   -> linking to %5B%60Message%60%5D(https://discord.js.org/#/docs/main/stable/class/Message)%3C%60boolean%60%5C (resolved as: /docs/Documentation/api-utilities/classes/%5B%60Message%60%5D(https://discord.js.org/)

- On source page path = /docs/Documentation/api-utilities/classes/sapphire_discord_js_utilities.PaginatedFieldMessageEmbed:
   -> linking to %5B%60MessageComponentInteraction%60%5D(https://discord.js.org/#/docs/main/stable/class/MessageComponentInteraction)%3C%60CacheType%60%5C (resolved as: /docs/Documentation/api-utilities/classes/%5B%60MessageComponentInteraction%60%5D(https://discord.js.org/)
   -> linking to %5B%60MessageEmbed%60%5D(https://discord.js.org/#/docs/main/stable/class/MessageEmbed)%5C (resolved as: /docs/Documentation/api-utilities/classes/%5B%60MessageEmbed%60%5D(https://discord.js.org/)
   -> linking to %5B%60MessageEmbed%60%5D(https://discord.js.org/#/docs/main/stable/class/MessageEmbed)%5B%5D%5C (resolved as: /docs/Documentation/api-utilities/classes/%5B%60MessageEmbed%60%5D(https://discord.js.org/)

- On source page path = /docs/Documentation/api-utilities/classes/sapphire_discord_js_utilities.PaginatedMessage:
   -> linking to %5B%60MessageComponentInteraction%60%5D(https://discord.js.org/#/docs/main/stable/class/MessageComponentInteraction)%3C%60CacheType%60%5C (resolved as: /docs/Documentation/api-utilities/classes/%5B%60MessageComponentInteraction%60%5D(https://discord.js.org/)
   -> linking to %5B%60MessageEmbed%60%5D(https://discord.js.org/#/docs/main/stable/class/MessageEmbed)%5C (resolved as: /docs/Documentation/api-utilities/classes/%5B%60MessageEmbed%60%5D(https://discord.js.org/)
   -> linking to %5B%60MessageEmbed%60%5D(https://discord.js.org/#/docs/main/stable/class/MessageEmbed)%5B%5D%5C (resolved as: /docs/Documentation/api-utilities/classes/%5B%60MessageEmbed%60%5D(https://discord.js.org/)

- On source page path = /docs/Documentation/api-utilities/interfaces/sapphire_discord_js_utilities.PaginatedMessageActionContext:
   -> linking to %5B%60MessageComponentInteraction%60%5D(https://discord.js.org/#/docs/main/stable/class/MessageComponentInteraction)%3C%60CacheType%60%5C (resolved as: /docs/Documentation/api-utilities/interfaces/%5B%60MessageComponentInteraction%60%5D(https://discord.js.org/)
    at async tryToBuildLocale (F:\dev\sapphiredev\website\node_modules\@docusaurus\core\lib\commands\build.js:35:20)
    at async mapAsyncSequencial (F:\dev\sapphiredev\website\node_modules\@docusaurus\utils\lib\index.js:263:24)
    at async build (F:\dev\sapphiredev\website\node_modules\@docusaurus\core\lib\commands\build.js:71:25)

And when running docusaurus serve despite that I see this on the website:
image

Strangely enough, the markdown for this code does appear to be valid markdown so my best guess is that Docusaurus is interpreting this markdown in a strange way. Maybe an escape character has to be added somewhere?

### fetchGuildPreview**fetchGuildPreview**(`guild`): [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[`GuildPreview`](https://discord.js.org/#/docs/main/stable/class/GuildPreview)\>

#### Parameters

| Name | Type |
| :------ | :------ |
| `guild` | `GuildResolvable` |

#### Returns

[`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[`GuildPreview`](https://discord.js.org/#/docs/main/stable/class/GuildPreview)\>

#### Inherited from

Client.fetchGuildPreview

#### Defined in

node_modules/discord.js/typings/index.d.ts:487

Bit annoying that this only shows when building the code so to make testing any potential fixes easier I've created a small repo which has the troublesome markdown files already generated: https://github.com/favna/animated-umbrella

The branch I linked in my initial bug report has also been updated with the latest version of the plugin.

@tgreyuk
Copy link
Member

tgreyuk commented Nov 13, 2021

thanks for the report back. that's interesting... i will take a look and report back.

@tgreyuk
Copy link
Member

tgreyuk commented Nov 14, 2021

So this is now appears to be fixed in typedoc-plugin-markdown@3.11.6

The fix was to add a space around the url inside the url parenthesis. ie: [Ref]( https://discord.js...... ). I have no idea why Docusarus complains without it but it definately appears to fix the issue and I have successfully built your repo without errors. Let me know if the same for you. thanks..

Screenshot 2021-11-14 at 23 27 22

@favna
Copy link
Author

favna commented Nov 17, 2021

Wasn't able to re-test this earlier but I can now confirm that this issue is resolved. Thank you for your awesome work! Closing this issue.

@favna favna closed this as completed Nov 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants