Skip to content

Commit

Permalink
feat: update typedoc to markdown plugin and config (#256)
Browse files Browse the repository at this point in the history
* feat: update typedoc to markdown plugin and config

chore: set file extension to mdx

feat: fully update to latest typedoc plugins

fix: remove file ext

fix: ensure docusaurus picks up the proper formatting

fix: ensure readmes are accessible from the sidebar

* chore: deps

* fix: fix more urls

* fix: update submodules for fixed markdown files
  • Loading branch information
favna authored May 9, 2024
1 parent a48e062 commit 2beb90a
Show file tree
Hide file tree
Showing 54 changed files with 21,036 additions and 21,029 deletions.
7 changes: 1 addition & 6 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,13 @@ All guides for the Sapphire Community use Markdown formatting.

When writing guides there are some rules to follow:

1. All files should have the `.md` file extension.
1. All files should have the `.mdx` file extension.
2. Folder names are allowed to have spaces.
3. All folder names should be in lower case and different words should be split by hyphens (e.g., `hello-world` or `getting-started`).
4. File names should _never_ have spaces.
5. File names that consist of multiple words should be PascalCased.
6. Information in a guide page should be generally useful to the majority of people.
- The single exception to this goes to guides in the "Advanced" folder, which can cover any kind of advanced or complex usage topic.
7. There are several variables that will be replaced when parsing the `.md` file for the documentation website. Variables are denoted by the pattern `{@variableName (parameter)}`. The supported variables are:
- `{@branch}` - for the current branch name.
- `{@link <TSDoc symbol name>}` - wherein `<TSDoc symbol name>` is a reference to some TypeScript interface / class / function etc parsed from TSDoc. This will link the API page of that symbol.
- `{@typedef <TSDoc interface/type/class name>}` - wherein `<TSDoc interface/type/class name>` is the name of a TypeScript interface, class or type. This will inline all the properties of that interface/type/class as a table, with links back to their API documentation page.
- `{@guide <Guide file name>}` - wherein `<Guide file name>` is the name of another guide file in this same project _without file extension_. For example linking to `CreatingArguments.md` would be `{@guide CreatingArguments}`.

## Contributing to the code

Expand Down
7 changes: 1 addition & 6 deletions docs/General/Welcome.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -302,10 +302,7 @@ client.login('your-token-goes-here');

## Links

- <span style={{ display: 'flex' }}>
<SimpleLink href="https://sapphirejs.dev" linkName="Website" /> (
<SimpleLink href="https://github.com/sapphiredev/website" linkName="source" noRightMargin />)
</span>
- <SimpleLink href="https://github.com/sapphiredev/website" linkName="Website source code" />
- <SimpleLink href="/docs/General/Welcome" linkName="Documentation" />
- <SimpleLink href="/docs/Guide/getting-started/getting-started-with-sapphire" linkName="Guide" />
- <SimpleLink href="https://sapphirejs.dev/discord" linkName="Sapphire Discord Server" />
Expand All @@ -327,7 +324,5 @@ If you don't understand something in the documentation, you are experiencing pro
in the right direction, please don't hesitate to join our official
[Sapphire Community Server](https://sapphirejs.dev/discord).

[frameworksdocs]: ../Documentation/api-framework/
[djs]: https://discord.js.org/
[saphfw]: https://github.com/sapphiredev/framework
[updating-guide]: ../Guide/getting-started/updating-from-v2-to-v3
2 changes: 1 addition & 1 deletion docs/Guide/CLI/custom-templates.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,4 @@ Now you can generate components using your template!
See [the page on generating components][generating-components] for more information.
[generating-components]: ./generating-components.md
[generating-components]: ./generating-components
File renamed without changes.
7 changes: 4 additions & 3 deletions docs/Guide/CLI/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,15 @@ To install `@sapphire/cli`, you can use one of the following methods:
pnpm add -g @sapphire/cli
```

- With yarn (v2 and beyond), use the [dlx command][dlx] (note that this will immediately execute the CLI, not install it
globally for use later. Yarn no longer has global dependencies.):
- With yarn (v2 and beyond), use the [dlx command ↗️][dlx] (note that this will immediately execute the CLI, not install
it globally for use later. Yarn no longer has global dependencies.):

```bash
yarn dlx @sapphire/cli
```

- If you're using [Volta] to manage your NodeJS versions, you can install the CLI tools with the following command:
- If you're using [Volta ↗️][volta] to manage your NodeJS versions, you can install the CLI tools with the following
command:
```bash
volta install @sapphire/cli
```
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ sidebar_position: 3
title: Implementing a discord.py like Cog system
---

Developer who come from the Python ecosystem may be familiar with the "[Cog]" system that discord.py has implemented.
This system allows you to group commands, listeners and other pieces into a [Cog] (also sometimes called "module"),
which can then be loaded and unloaded as a whole. This is a useful system for large bots, as it allows you to easily
split your code into multiple files, and only load the parts you need.
Developer who come from the Python ecosystem may be familiar with the "[Cog ↗️][cog]" system that discord.py has
implemented. This system allows you to group commands, listeners and other pieces into a [Cog ↗️][cog] (also sometimes
called "module"), which can then be loaded and unloaded as a whole. This is a useful system for large bots, as it allows
you to easily split your code into multiple files, and only load the parts you need.

While Sapphire does not natively have a built-in [Cog] system, it is possible to implement one yourself. This guide will
teach you how to do this.
While Sapphire does not natively have a built-in [Cog ↗️][cog] system, it is possible to implement one yourself. This
guide will teach you how to do this.

For this guide we will register an `audio` cog which will have commands and listeners related to playing music through
your bot. This cog will be called `audio` and have subfolders of `commands` and `listeners`. That is to say, the general
Expand Down Expand Up @@ -72,7 +72,7 @@ is to say, pieces in `audio/commands` will be parsed as commands, pieces in `aud
listeners, etc.

[cog]: https://discordpy.readthedocs.io/en/stable/ext/commands/cogs.html
[`getRootData`]: ../../Documentation/api-pieces/#getrootdata
[`registerPath`]: ../../Documentation/api-pieces/classes/Store-1#registerpath
[`getRootData`]: ../../Documentation/api-pieces/functions/getRootData
[`registerPath`]: ../../Documentation/api-pieces/classes/Store#registerpath
[`SapphireClient`]: ../../Documentation/api-framework/classes/SapphireClient
[`StoreRegistry`]: ../../Documentation/api-pieces/classes/StoreRegistry
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ export class MyOverloadedClient extends SapphireClient {
Once the `interactions` folder is registered this way, Sapphire will automatically also load [`InteractionHandler`]
classes from this folder.

[`getRootData`]: ../../Documentation/api-pieces/#getrootdata
[`InteractionHandler`]: ../../Documentation/api-framework/classes/InteractionHandler-1
[`registerPath`]: ../../Documentation/api-pieces/classes/Store-1#registerpath
[`getRootData`]: ../../Documentation/api-pieces/functions/getRootData
[`InteractionHandler`]: ../../Documentation/api-framework/classes/InteractionHandler
[`registerPath`]: ../../Documentation/api-pieces/classes/Store#registerpath
[`SapphireClient`]: ../../Documentation/api-framework/classes/SapphireClient
[`Store`]: ../../Documentation/api-pieces/classes/Store-1
[`Store`]: ../../Documentation/api-pieces/classes/Store
10 changes: 5 additions & 5 deletions docs/Guide/additional-information/registering-virtual-pieces.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ directly into the [`container`][container]. This is useful for several purposes:

- Pieces that are not stored on the file system, such as pieces that are generated at runtime.
- Pieces that are stored on the file system, but are not loaded by Sapphire. For example, this can occur due to runtime
limitations where file system operations are either restricted or not possible (think: [Serverless Computing][sc]).
- Bundling the bot into a single file. This is useful for [serverless deployments][sc], where you cannot rely on the
limitations where file system operations are either restricted or not possible (think: [Serverless Computing ↗️][sc]).
- Bundling the bot into a single file. This is useful for [serverless deployments ↗️][sc], where you cannot rely on the
file system.

## Registering virtual pieces
Expand Down Expand Up @@ -180,11 +180,11 @@ Virtual pieces have the following limitations:
- Virtual pieces have to be imported manually, which can require long chains of imports.

[`loadPiece`]: ../../Documentation/api-pieces/classes/StoreRegistry#loadpiece
[`loadAll`]: ../../Documentation/api-pieces/classes/Store-1#loadall
[`loadAll`]: ../../Documentation/api-pieces/classes/Store#loadall
[`SapphireClient#login`]: ../../Documentation/api-framework/classes/SapphireClient#login
[`SapphireClientOptions#baseUserDirectory`]:
../../Documentation/api-framework/interfaces/SapphireClientOptions#baseuserdirectory
[`VirtualPath`]: ../../Documentation/api-pieces/#virtualpath
[`Command#fullCategory`]: ../../Documentation/api-framework/classes/Command-1#fullcategory
[`VirtualPath`]: ../../Documentation/api-pieces/variables/VirtualPath
[`Command#fullCategory`]: ../../Documentation/api-framework/classes/Command#fullcategory
[container]: ../../Documentation/api-pieces/interfaces/Container
[sc]: https://en.wikipedia.org/wiki/Serverless_computing
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ sidebar_position: 1
title: Using and extending container
---

The `container` is a way in which Sapphire achieves [Dependency Injection][di]. This is a very useful feature, since it
allows accessing the client, the stores and various other properties from anywhere in your code.
The `container` is a way in which Sapphire achieves [Dependency Injection ↗️][di]. This is a very useful feature, since
it allows accessing the client, the stores and various other properties from anywhere in your code.

## Using `container`

Expand Down
79 changes: 40 additions & 39 deletions docs/Guide/arguments/built-in-arguments.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,67 +11,68 @@ These can be used anytime with the `Args` class, and can be accessed via `contai

:::warning Overriding

If you define an `Argument` with the same name as a built-in one, e.g. [`boolean`][boolean], the one you define will
If you define an `Argument` with the same name as a built-in one, e.g. [`boolean` ↗️][boolean], the one you define will
replace the built-in one. This applies to all other stores from the framework and plugins.

:::

To facilitate creating commands and getting your bot running, Sapphire bundles a large set of argument resolvers.

- `boolean`: Resolves to a [`boolean`][boolean] value.
- `channel`: Resolves to a [`Channel`][channel] instance, given a channel name, mention or ID.
- `date`: Resolves to a [`Date`][date] instance, given a valid date format. For a list of valid date formats see
[Several ways to create a Date object on MDN][mdn-date]
- `dmChannel`: Resolves to a [`DMChannel`][dmchannel] instance, given a DM channel ID or user's ID.
- `boolean`: Resolves to a [`boolean` ↗️][boolean] value.
- `channel`: Resolves to a [`Channel` ↗️][channel] instance, given a channel name, mention or ID.
- `date`: Resolves to a [`Date` ↗️][date] instance, given a valid date format. For a list of valid date formats see
[Several ways to create a Date object on MDN ↗️][mdn-date]
- `dmChannel`: Resolves to a [`DMChannel` ↗️][dmchannel] instance, given a DM channel ID or user's ID.
- `emoji`: Resolves to an [`EmojiObject`][emojiobject]. The `id` is `null` for Twemojis.
- `float` / `number`: Resolves to any number.
- `guild`: Resolves to a [`Guild`][guild] instance, given ID.
- `guildCategoryChannel`: Resolves to a [`CategoryChannel`][categorychannel] instance, given a category channel name,
- `guild`: Resolves to a [`Guild` ↗️][guild] instance, given ID.
- `guildCategoryChannel`: Resolves to a [`CategoryChannel` ↗️][categorychannel] instance, given a category channel name,
mention or ID.
- `guildChannel`: Resolves to a [`GuildChannel`][guildchannel] or a [`ThreadChannel`][threadchannel] instance, given a
channel name, mention or ID.
- `guildNewsChannel`: Resolves to a [`NewsChannel`][newschannel] instance, given a news channel name, mention or ID.
- `guildNewsThreadChannel`: Resolves to a [`ThreadChannel`][threadchannel] instance of type `GUILD_NEWS_THREAD`, given a
thread channel name, mention or ID.
- `guildPrivateThreadChannel`: Resolves to a [`ThreadChannel`][threadchannel] instance of type `GUILD_PRIVATE_THREAD`,
- `guildChannel`: Resolves to a [`GuildChannel` ↗️][guildchannel] or a [`ThreadChannel` ↗️][threadchannel] instance,
given a channel name, mention or ID.
- `guildNewsChannel`: Resolves to a [`NewsChannel` ↗️][newschannel] instance, given a news channel name, mention or ID.
- `guildNewsThreadChannel`: Resolves to a [`ThreadChannel` ↗️][threadchannel] instance of type `GUILD_NEWS_THREAD`,
given a thread channel name, mention or ID.
- `guildPublicThreadChannel`: Resolves to a [`ThreadChannel`][threadchannel] instance of type `GUILD_PUBLIC_THREAD`,
- `guildPrivateThreadChannel`: Resolves to a [`ThreadChannel` ↗️][threadchannel] instance of type
`GUILD_PRIVATE_THREAD`, given a thread channel name, mention or ID.
- `guildPublicThreadChannel`: Resolves to a [`ThreadChannel` ↗️][threadchannel] instance of type `GUILD_PUBLIC_THREAD`,
given a thread channel name, mention or ID.
- `guildStageVoiceChannel`: Resolves to a [`StageChannel`][stagechannel] instance, given a stage voice channel name,
- `guildStageVoiceChannel`: Resolves to a [`StageChannel` ↗️][stagechannel] instance, given a stage voice channel name,
mention or ID.
- `guildTextChannel`: Resolves to a [`TextChannel`][textchannel] instance, given a text channel name, mention or ID.
- `guildThreadChannel`: Resolves to a [`ThreadChannel`][threadchannel] instance, given a thread channel name, mention or
- `guildTextChannel`: Resolves to a [`TextChannel` ↗️][textchannel] instance, given a text channel name, mention or ID.
- `guildThreadChannel`: Resolves to a [`ThreadChannel` ↗️][threadchannel] instance, given a thread channel name, mention
or ID.
- `guildVoiceChannel`: Resolves to a [`VoiceChannel` ↗️][voicechannel] instance, given a voice channel name, mention or
ID.
- `guildVoiceChannel`: Resolves to a [`VoiceChannel`][voicechannel] instance, given a voice channel name, mention or ID.
- `hyperlink` / `url`: Resolves to a [`URL`][url] instance, given a valid URL.
- `hyperlink` / `url`: Resolves to a [`URL` ↗️][url] instance, given a valid URL.
- `integer`: Resolves to a safe integer.
- `member`: Resolves to a [`GuildMember`][guildmember] instance, given a member name, mention or ID.
- `message`: Resolves to a [`Message`][message] instance, given a message link or ID.
- `member`: Resolves to a [`GuildMember` ↗️][guildmember] instance, given a member name, mention or ID.
- `message`: Resolves to a [`Message` ↗️][message] instance, given a message link or ID.
- `partialDMChannel`: Resolves to a `PartialDMChannel` instance, given a DM channel ID or user's ID.
- `role`: Resolves to a [`Role`][role] instance, given a role name, mention or ID.
- `role`: Resolves to a [`Role` ↗️][role] instance, given a role name, mention or ID.
- `string`: Resolves to a string containing the parameter.
- `user`: Resolves to a [`User`][user] instance, given a user mention or ID.
- `enum`: Resolves to a string if it occurs within the [`array`][array] of possible items that is passed as an option
- `user`: Resolves to a [`User` ↗️][user] instance, given a user mention or ID.
- `enum`: Resolves to a string if it occurs within the [`array` ↗️][array] of possible items that is passed as an option
(`enum`).

[array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array
[boolean]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean
[categorychannel]: https://old.discordjs.dev/#/docs/discord.js/main/class/CategoryChannel
[channel]: https://old.discordjs.dev/#/docs/discord.js/main/class/BaseChannel
[categorychannel]: https://discord.js.org/docs/packages/discord.js/main/CategoryChannel:Class
[channel]: https://discord.js.org/docs/packages/discord.js/main/BaseChannel:Class
[date]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date
[dmchannel]: https://old.discordjs.dev/#/docs/discord.js/main/class/DMChannel
[guild]: https://old.discordjs.dev/#/docs/discord.js/main/class/Guild
[guildchannel]: https://old.discordjs.dev/#/docs/discord.js/main/class/GuildChannel
[dmchannel]: https://discord.js.org/docs/packages/discord.js/main/DMChannel:Class
[guild]: https://discord.js.org/docs/packages/discord.js/main/Guild:Class
[guildchannel]: https://discord.js.org/docs/packages/discord.js/main/GuildChannel:Class
[emojiobject]: ../../Documentation/api-framework/interfaces/EmojiObject
[guildmember]: https://old.discordjs.dev/#/docs/discord.js/main/class/GuildMember
[guildmember]: https://discord.js.org/docs/packages/discord.js/main/GuildMember:Class
[mdn-date]:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#several_ways_to_create_a_date_object
[message]: https://old.discordjs.dev/#/docs/discord.js/main/class/Message
[newschannel]: https://old.discordjs.dev/#/docs/discord.js/main/class/NewsChannel
[role]: https://old.discordjs.dev/#/docs/discord.js/main/class/Role
[stagechannel]: https://old.discordjs.dev/#/docs/discord.js/main/class/StageChannel
[textchannel]: https://old.discordjs.dev/#/docs/discord.js/main/class/TextChannel
[threadchannel]: https://old.discordjs.dev/#/docs/discord.js/main/class/ThreadChannel
[message]: https://discord.js.org/docs/packages/discord.js/main/Message:Class
[newschannel]: https://discord.js.org/docs/packages/discord.js/main/NewsChannel:Class
[role]: https://discord.js.org/docs/packages/discord.js/main/Role:Class
[stagechannel]: https://discord.js.org/docs/packages/discord.js/main/StageChannel:Class
[textchannel]: https://discord.js.org/docs/packages/discord.js/main/TextChannel:Class
[threadchannel]: https://discord.js.org/docs/packages/discord.js/main/ThreadChannel:Class
[url]: https://nodejs.org/api/url.html
[user]: https://old.discordjs.dev/#/docs/discord.js/main/class/User
[voicechannel]: https://old.discordjs.dev/#/docs/discord.js/main/class/VoiceChannel
[user]: https://discord.js.org/docs/packages/discord.js/main/User:Class
[voicechannel]: https://discord.js.org/docs/packages/discord.js/main/VoiceChannel:Class
2 changes: 1 addition & 1 deletion docs/Guide/arguments/creating-your-own-arguments.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -171,4 +171,4 @@ argument is created below using the Args.make method, which takes the parameter,
nullish or empty and returns the value. If not, an error is returned.

[bia]: ./built-in-arguments
[argtype-interface]: ../../Documentation/api-framework/interfaces/ArgType.md
[argtype-interface]: ../../Documentation/api-framework/interfaces/ArgType
2 changes: 1 addition & 1 deletion docs/Guide/arguments/using-arguments.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class EchoCommand extends Command {
```

Sapphire's arguments work by consuming the delimited elements of user input one by one upon success, similar to how an
[iterator] works. We'll go into more details and examples in another command.
[`iterator` ↗️][iterator] works. We'll go into more details and examples in another command.

In this command, [`args.pick('<type>')`][pick] is used to read a single argument from the user's input. The `<type>`
here is `string`, so it'll return the argument as-is since all data in a message's body is textual.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ Read [Registering Application Commands outside a Command][register-outside] for

:::

[register-application-commands]: ../../../../Documentation/api-framework/classes/Command-1#registerapplicationcommands
[command]: ../../../../Documentation/api-framework/classes/Command-1
[register-application-commands]: ../../../../Documentation/api-framework/classes/Command#registerapplicationcommands
[command]: ../../../../Documentation/api-framework/classes/Command
[register-outside]: ./advanced/registering-application-commands-outside-a-command
Loading

0 comments on commit 2beb90a

Please sign in to comment.