Skip to content

Commit 45c70b6

Browse files
committed
chore: add markdown extension for table spanning
1 parent f389990 commit 45c70b6

4 files changed

Lines changed: 83 additions & 30 deletions

File tree

astro.config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import starlight from "@astrojs/starlight";
22
import svelte from "@astrojs/svelte";
33
import d2 from "astro-d2";
44
import { defineConfig } from "astro/config";
5+
import { extendedTableHandlers, remarkExtendedTable } from "remark-extended-table";
56
import starlightLinksValidator from "starlight-links-validator";
67
import starlightSidebarTopics from "starlight-sidebar-topics";
78
import codeConstantsPlugin from "./src/utils/remark/code_const";
@@ -552,7 +553,13 @@ export default defineConfig({
552553
domains: ["assets.papermc.io"],
553554
},
554555
markdown: {
556+
remarkRehype: {
557+
handlers: {
558+
...extendedTableHandlers,
559+
},
560+
},
555561
remarkPlugins: [
562+
remarkExtendedTable,
556563
[
557564
javadocPlugin,
558565
{

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"astro": "^6.1.3",
2323
"astro-contributors": "^0.8.0",
2424
"astro-d2": "^0.10.0",
25+
"remark-extended-table": "^2.0.3",
2526
"sharp": "^0.34.5",
2627
"starlight-links-validator": "^0.20.1",
2728
"starlight-sidebar-topics": "^0.7.1",

pnpm-lock.yaml

Lines changed: 67 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/content/docs/adventure/minimessage/format.mdx

Lines changed: 8 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -237,38 +237,16 @@ Arguments
237237
* `_action_`, the type of hover event, one of this [list](https://jd.advntr.dev/api/latest/net/kyori/adventure/text/event/HoverEvent.Action.html#field.summary)
238238
* `_value_`, argument(s) specific to each event action:
239239

240-
[//]: # (Starlight's padding doesn't apply for a spanned cell, so a manual padding is added)
241-
<table>
242-
<tbody>
243-
<tr>
244-
<th>Action</th>
245-
<th>Value</th>
246-
<th>Description</th>
247-
</tr>
248-
<tr>
249-
<td>`show_text`</td>
250-
<td>`_text_`</td>
251-
<td>a MiniMessage string</td>
252-
</tr>
253-
<tr>
254-
<td rowSpan={2}>`show_item`</td>
255-
<td>`_type_[:_count_[(:_componentKey_:_componentValue_)...]]`</td>
256-
<td>a `Key` for the item's type, optionally followed by count (an integer) and a list of <a href="https://minecraft.wiki/w/Data_component_format" target="_blank">data component</a> key value pairs</td>
257-
</tr>
258-
<tr>
259-
<td style={{ paddingLeft: "1rem" }}><Badge variant="caution" text="Legacy" /> `_type_[:_count_[:tag]]`</td>
260-
<td>a `Key` for the item's type, optionally followed by count (an integer) and tag (a <a href="https://minecraft.wiki/w/NBT_format#SNBT_format" target="_blank">SNBT</a> string)</td>
261-
</tr>
262-
<tr>
263-
<td>`show_entity`</td>
264-
<td>`_type_:_uuid_[:_name_]`</td>
265-
<td>a `Key` ID of the entity type, the entity's UUID, and an optional custom name</td>
266-
</tr>
267-
</tbody>
268-
</table>
240+
[//]: # (FIXME: Starlight's padding doesn't apply for a spanned cell, so a manual padding is added)
241+
| Action | Value | Description |
242+
|---------------|------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
243+
| `show_text` | `_text_` | a MiniMessage string |
244+
| `show_item` | `_type_[:_count_[(:_componentKey_:_componentValue_)...]]` | a `Key` for the item's type, optionally followed by count (an integer) and a list of [data component](https://minecraft.wiki/w/Data_component_format) key value pairs |
245+
| ^ | <span style="padding-left: 1rem"><Badge variant="caution" text="Legacy" /> `_type_[:_count_[:tag]]`</span> | a `Key` for the item's type, optionally followed by count (an integer) and tag (a [SNBT](https://minecraft.wiki/w/NBT_format#SNBT_format) string) |
246+
| `show_entity` | `_type_:_uuid_[:_name_]` | a `Key` ID of the entity type, the entity's UUID, and an optional custom name |
269247

270248
:::caution
271-
`_type_[:_count_[:tag]]` value format for `show_item` action is considered legacy and support for it may eventually be removed.
249+
The `_type_[:_count_[:tag]]` value format for the `show_item` action is considered legacy and support for it may eventually be removed.
272250
The recommended format is `_type_[:_count_[(:_componentKey_:_componentValue_)...]]`.
273251
:::
274252

0 commit comments

Comments
 (0)