succesfully implemented mdx

This commit is contained in:
2024-02-02 10:02:31 +01:00
parent 53008701e0
commit 2f962e3e90
4 changed files with 84 additions and 81 deletions

View File

@@ -1,20 +1,21 @@
import { defineConfig } from 'astro/config';
import minify from 'astro-min';
import metaTags from "astro-meta-tags";
import rehypeSlug from 'rehype-slug'
import rehypeSlug from 'rehype-slug';
import rehypeAutolinkHeadings from 'rehype-autolink-headings';
import mdx from "@astrojs/mdx";
// https://astro.build/config
export default defineConfig({
integrations: [minify(), metaTags()],
integrations: [minify(), metaTags(), mdx()],
markdown: {
rehypePlugins: [
rehypeSlug,
[rehypeAutolinkHeadings, { behavior: 'prepend' }],
],
rehypePlugins: [rehypeSlug, [rehypeAutolinkHeadings, {
behavior: 'prepend'
}]],
drafts: true,
shikiConfig: {
theme: 'dracula',
},
},
theme: 'dracula'
}
}
});

View File

@@ -1,6 +1,6 @@
---
import Layout from "../layouts/Layout.astro";
const unsortedDocs = await Astro.glob("./docs/*/*.md");
const unsortedDocs = await Astro.glob("./docs/*/*.mdx");
const docs = unsortedDocs
.sort(
(a, b) => +new Date(b.frontmatter.date) - +new Date(a.frontmatter.date),

View File

@@ -1,71 +0,0 @@
---
layout: ../../../layouts/Docslayout.astro
title: Home
draft: true
---
> [!IMPORTANT]
> The GameSDK's Achievements, Applications, Voice, Images, Lobbies, Networking, Storage, and Store (purchases and discounts) features have been deprecated and will not be added. <br> However the rest is and will still be supported by Discord.
**[![apple](https://github.com/vaporvee/discord-sdk-godot/assets/80621863/6d2c7a54-bfc9-4c8d-955a-40fa5c9e8c74)About MacOS Support](https://github.com/vaporvee/discord-sdk-godot/wiki/Building#macos-support)**<br>
> [!WARNING]
> The plugin only works with 4.2 and above for the current version
> [!NOTE]
> To make anything work in the plugin make sure to run
> ```gdscript
>func _process(_delta):
> DiscordSDK.run_callbacks()
> ```
> This happens normaly inside the Autoload wich should be automatically added by the plugin. <br>
> Something that does **not get added automatically** is your `app_id`. It is also mandatory to be able to use anything in the plugin.
> ```gdscript
> DiscordSDK.app_id = #<your Application ID>
> ```
# Quick start
| Recommended | Manual |
| ----------- | ------ |
| 1. Open the AssetLib tab in your Godot Editor. <br> 2. Search for "discord" and install all the files from this plugin <img width="30px" src="https://raw.githubusercontent.com/vaporvee/discord-sdk-godot/main/project/assets/Logo_V2_Clyde.png"> | 1. [Download the addon](https://github.com/vaporvee/discord-sdk-godot/releases/latest/download/ADDON-Discord-SDK-Godot.zip/) <br> 2. Put the `addons/` folder in the root of your Godot project |
3. Enable the addon in your Project Settings under "Plugins" and "DiscordSDK". <br><sub>(Also adds DiscordSDKLoader autoload wich should be ignored. It needs to run in the background to comunicate with the Discord client)</sub>
4. Restart your project with the window that should now appear. <br>
<img src="https://github.com/vaporvee/discord-sdk-godot/assets/80621863/620d90aa-6e76-4a80-980e-c8c57d8cfa58" width="200px"><br>
5. Create an Application under https://discord.com/developers/applications and get the Application ID
6. While you're here, head to the "OAuth2" section of your application and add `http://127.0.0.1` as a redirect URI for your application.<br><sub>(Discord says you should do that but it doesn't change anything)</sub>
7. (optional) Set images under "Rich Presence" and "Art Assets" and remember the keys
8. Create a gdscript wich gets run for example at startup wich looks something like the following
```gdscript
extends Node
func _ready():
DiscordSDK.app_id = 1099618430065324082 # Application ID
DiscordSDK.details = "A demo activity by vaporvee"
DiscordSDK.state = "Checkpoint 23/23"
DiscordSDK.large_image = "example_game" # Image key from "Art Assets"
DiscordSDK.large_image_text = "Try it now!"
DiscordSDK.small_image = "boss" # Image key from "Art Assets"
DiscordSDK.small_image_text = "Fighting the end boss! D:"
DiscordSDK.start_timestamp = int(Time.get_unix_time_from_system()) # "02:46 elapsed"
# DiscordSDK.end_timestamp = int(Time.get_unix_time_from_system()) + 3600 # +1 hour in unix time / "01:00:00 remaining"
DiscordSDK.refresh() # Always refresh after changing the values!
```
**Then it will look similar to this:**
<img src="https://raw.githubusercontent.com/vaporvee/discord-sdk-godot/main/project/assets/ActivityPreview.svg">
[**Try a built demo**](https://github.com/vaporvee/discord-sdk-godot/releases/latest/download/Demo-Export.zip)<br><br>
# Troubleshooting
> [!TIP]
> First of all try reinstalling the plugin and restart both your Godot Editor and your Discord client.
> <details>
> <summary><b>I have no errors in my Godot console from the plugin but my Activity doesn't show up in my Discord Client.</b></summary>
> <p>Make sure a `DiscordSDK.run_callbacks()` function runs in a `_process(delta)` function. This should happen in the Autoload added by the plugin. If it still doesn't help, try the Demo above. If still nothing appears in your Discord profile card, you have to reset the depending settings in you Discord or reinstall it.</p>
> </details>
> <details>
> <summary><b>I have a lot of `DiscordSDK not declared` errors spammed in my Godot Console and i can't use the plugin.</b></summary>
> <p>Make sure the plugin is actually enabled. Then the plugin should work and after the second restart you shouldn't get any errors from the plugin. But if it still gives you the errors delete the file `/addons/discord-sdk-gd/bin/.gdignore` and restart the editor manually.</p>
</details>

View File

@@ -0,0 +1,73 @@
---
layout: ../../../layouts/Docslayout.astro
title: Home
draft: true
---
> [!IMPORTANT]
> The GameSDK's Achievements, Applications, Voice, Images, Lobbies, Networking, Storage, and Store (purchases and discounts) features have been deprecated and will not be added. <br /> However the rest is and will still be supported by Discord.
**[![apple](https://github.com/vaporvee/discord-sdk-godot/assets/80621863/6d2c7a54-bfc9-4c8d-955a-40fa5c9e8c74)About MacOS Support](https://github.com/vaporvee/discord-sdk-godot/wiki/Building#macos-support)**<br />
> [!WARNING]
> The plugin only works with 4.2 and above for the current version
> [!NOTE]
> To make anything work in the plugin make sure to run
>
> ```gdscript
> func _process(_delta):
> DiscordSDK.run_callbacks()
> ```
>
> This happens normaly inside the Autoload wich should be automatically added by the plugin. <br />
> Something that does **not get added automatically** is your `app_id`. It is also mandatory to be able to use anything in the plugin.
>
> ```gdscript
> DiscordSDK.app_id = #<your Application ID>
> ```
# Quick start
| Recommended | Manual |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 1. Open the AssetLib tab in your Godot Editor. <br /> 2. Search for "discord" and install all the files from this plugin <img width="30px" src="https://raw.githubusercontent.com/vaporvee/discord-sdk-godot/main/project/assets/Logo_V2_Clyde.png" /> | 1. [Download the addon](https://github.com/vaporvee/discord-sdk-godot/releases/latest/download/ADDON-Discord-SDK-Godot.zip/) <br /> 2. Put the `addons/` folder in the root of your Godot project |
3. Enable the addon in your Project Settings under "Plugins" and "DiscordSDK". <br /><sub>(Also adds DiscordSDKLoader autoload wich should be ignored. It needs to run in the background to comunicate with the Discord client)</sub>
4. Restart your project with the window that should now appear. <br /><img src="https://github.com/vaporvee/discord-sdk-godot/assets/80621863/620d90aa-6e76-4a80-980e-c8c57d8cfa58" width="200px" /><br />
5. Create an Application under https://discord.com/developers/applications and get the Application ID
6. While you're here, head to the "OAuth2" section of your application and add `http://127.0.0.1` as a redirect URI for your application.<br /><sub>(Discord says you should do that but it doesn't change anything)</sub>
7. (optional) Set images under "Rich Presence" and "Art Assets" and remember the keys
8. Create a gdscript wich gets run for example at startup wich looks something like the following
```gdscript
extends Node
func _ready():
DiscordSDK.app_id = 1099618430065324082 # Application ID
DiscordSDK.details = "A demo activity by vaporvee"
DiscordSDK.state = "Checkpoint 23/23"
DiscordSDK.large_image = "example_game" # Image key from "Art Assets"
DiscordSDK.large_image_text = "Try it now!"
DiscordSDK.small_image = "boss" # Image key from "Art Assets"
DiscordSDK.small_image_text = "Fighting the end boss! D:"
DiscordSDK.start_timestamp = int(Time.get_unix_time_from_system()) # "02:46 elapsed"
# DiscordSDK.end_timestamp = int(Time.get_unix_time_from_system()) + 3600 # +1 hour in unix time / "01:00:00 remaining"
DiscordSDK.refresh() # Always refresh after changing the values!
```
**Then it will look similar to this:**
<img src="https://raw.githubusercontent.com/vaporvee/discord-sdk-godot/main/project/assets/ActivityPreview.svg" />
[**Try a built demo**](https://github.com/vaporvee/discord-sdk-godot/releases/latest/download/Demo-Export.zip)<br /><br />
# Troubleshooting
> [!TIP]
> First of all try reinstalling the plugin and restart both your Godot Editor and your Discord client.
> <details><summary><b>I have no errors in my Godot console from the plugin but my Activity doesn't show up in my Discord Client.</b></summary>Make sure a `DiscordSDK.run_callbacks()` function runs in a `_process(delta)` function. This should happen in the Autoload added by the plugin. If it still doesn't help, try the Demo above. If still nothing appears in your Discord profile card, you have to reset the depending settings in you Discord or reinstall it.</details>
> <details><summary><b>I have a lot of `DiscordSDK not declared` errors spammed in my Godot Console and i can't use the plugin.</b></summary> Make sure the plugin is actually enabled. Then the plugin should work and after the second restart you shouldn't get any errors from the plugin. But if it still gives you the errors delete the file `/addons/discord-sdk-gd/bin/.gdignore` and restart the editor manually.</details>