Skip to content

Commit ae1b869

Browse files
committed
Improve command table wrapping
1 parent 74d9e62 commit ae1b869

30 files changed

Lines changed: 178 additions & 122 deletions

scripts/generate-site-content.mjs

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@ function escapeHtml(value) {
107107
.trim();
108108
}
109109

110+
function formatCommand(value) {
111+
return escapeHtml(value)
112+
.replaceAll('|', '|<wbr />');
113+
}
114+
110115
function uniqueValues(values) {
111116
const seen = new Set();
112117
const unique = [];
@@ -807,12 +812,12 @@ function extractCommandData(markdown) {
807812
function commandTable(commands) {
808813
const rows = commands
809814
.map(([command, purpose]) => ` <tr>
810-
<td><code>${escapeHtml(command)}</code></td>
815+
<td><code>${formatCommand(command)}</code></td>
811816
<td>${escapeHtml(purpose)}</td>
812817
</tr>`)
813818
.join('\n');
814819

815-
return `<table>
820+
return `<table class="command-table">
816821
<thead>
817822
<tr>
818823
<th>Command</th>
@@ -829,13 +834,13 @@ function commandIndexTable(rows, guidePathPrefix = '../plugins/') {
829834
const htmlRows = rows
830835
.map((row) => ` <tr>
831836
<td><a href="${guidePathPrefix}${row.slug}/">${escapeHtml(row.plugin)}</a></td>
832-
<td><code>${escapeHtml(row.command)}</code></td>
837+
<td><code>${formatCommand(row.command)}</code></td>
833838
<td>${escapeHtml(friendlyText(row.description))}</td>
834-
<td><code>${escapeHtml(row.example)}</code></td>
839+
<td><code>${formatCommand(row.example)}</code></td>
835840
</tr>`)
836841
.join('\n');
837842

838-
return `<table>
843+
return `<table class="command-table command-index-table">
839844
<thead>
840845
<tr>
841846
<th>Feature</th>
@@ -855,7 +860,7 @@ function commandPreview(details, guideHref) {
855860
if (!commands.length) {
856861
return 'No player commands listed yet.';
857862
}
858-
const preview = commands.slice(0, 4).map((command) => `<code>${escapeHtml(command)}</code>`).join(', ');
863+
const preview = commands.slice(0, 4).map((command) => `<code>${formatCommand(command)}</code>`).join(', ');
859864
const hidden = commands.length - 4;
860865
if (hidden <= 0) {
861866
return preview;
@@ -908,13 +913,13 @@ ${rows}
908913
function pluginCommandTable(plugin, commandData) {
909914
const rows = commandData.playerCommands
910915
.map((command) => ` <tr>
911-
<td><code>${escapeHtml(command)}</code></td>
916+
<td><code>${formatCommand(command)}</code></td>
912917
<td>${escapeHtml(friendlyText(commandData.descriptions.get(command) || commandDescription(command, plugin)))}</td>
913-
<td><code>${escapeHtml(commandExample(command))}</code></td>
918+
<td><code>${formatCommand(commandExample(command))}</code></td>
914919
</tr>`)
915920
.join('\n');
916921

917-
return `<table>
922+
return `<table class="command-table plugin-command-table">
918923
<thead>
919924
<tr>
920925
<th>Command</th>

src/content/docs/player-guides/commands.mdx

Lines changed: 40 additions & 40 deletions
Large diffs are not rendered by default.

src/content/docs/player-guides/features.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ These are the current player-facing feature guides generated from the synced pro
2525
<td><a href="../plugins/recordingmode/">RecordingMode</a></td>
2626
<td>Player Fun</td>
2727
<td>Quiet selected personal messages and requests while recording or streaming.</td>
28-
<td><code>/recording</code>, <code>/recording status</code>, <code>/recording help</code>, <code>/recording set msg &lt;on|off&gt;</code>, <a href="../plugins/recordingmode/">+7 more</a></td>
28+
<td><code>/recording</code>, <code>/recording status</code>, <code>/recording help</code>, <code>/recording set msg &lt;on|<wbr />off&gt;</code>, <a href="../plugins/recordingmode/">+7 more</a></td>
2929
</tr>
3030
<tr>
3131
<td><a href="../plugins/sellstreaks/">SellStreaks</a></td>
@@ -67,7 +67,7 @@ These are the current player-facing feature guides generated from the synced pro
6767
<td><a href="../plugins/kitstreaks/">KitStreaks</a></td>
6868
<td>Player Fun</td>
6969
<td>Track kit claim streaks, milestone calendars, and reward progress.</td>
70-
<td><code>/kitstreak info</code>, <code>/kitstreak status [track|kit:&lt;kit&gt;]</code>, <code>/kitstreak tracks [page]</code>, <code>/kitstreak kits [page]</code>, <a href="../plugins/kitstreaks/">+4 more</a></td>
70+
<td><code>/kitstreak info</code>, <code>/kitstreak status [track|<wbr />kit:&lt;kit&gt;]</code>, <code>/kitstreak tracks [page]</code>, <code>/kitstreak kits [page]</code>, <a href="../plugins/kitstreaks/">+4 more</a></td>
7171
</tr>
7272
<tr>
7373
<td><a href="../plugins/messagefont/">MessageFont</a></td>
@@ -121,7 +121,7 @@ These are the current player-facing feature guides generated from the synced pro
121121
<td><a href="../plugins/discordchat/">DiscordChat</a></td>
122122
<td>Player Fun</td>
123123
<td>Player guide for DiscordChat, with commands, examples, and basic usage notes.</td>
124-
<td><code>/discordchat</code>, <code>/discordchat status</code>, <code>/discordchat top [points|streak|messages|words|emotes]</code>, <code>/discordchat pulse</code>, <a href="../plugins/discordchat/">+9 more</a></td>
124+
<td><code>/discordchat</code>, <code>/discordchat status</code>, <code>/discordchat top [points|<wbr />streak|<wbr />messages|<wbr />words|<wbr />emotes]</code>, <code>/discordchat pulse</code>, <a href="../plugins/discordchat/">+9 more</a></td>
125125
</tr>
126126
<tr>
127127
<td><a href="../plugins/gametypes/">GameTypes</a></td>
@@ -133,7 +133,7 @@ These are the current player-facing feature guides generated from the synced pro
133133
<td><a href="../plugins/birthdaylanterns/">BirthdayLanterns</a></td>
134134
<td>Player Fun</td>
135135
<td>Player guide for BirthdayLanterns, with commands, examples, and basic usage notes.</td>
136-
<td><code>/birthday</code>, <code>/birthday status</code>, <code>/birthday set &lt;month day|MM-DD|YYYY-MM-DD&gt;</code>, <code>/birthday visibility &lt;private|public&gt;</code>, <a href="../plugins/birthdaylanterns/">+9 more</a></td>
136+
<td><code>/birthday</code>, <code>/birthday status</code>, <code>/birthday set &lt;month day|<wbr />MM-DD|<wbr />YYYY-MM-DD&gt;</code>, <code>/birthday visibility &lt;private|<wbr />public&gt;</code>, <a href="../plugins/birthdaylanterns/">+9 more</a></td>
137137
</tr>
138138
<tr>
139139
<td><a href="../plugins/mobhat/">MobHat</a></td>
@@ -145,7 +145,7 @@ These are the current player-facing feature guides generated from the synced pro
145145
<td><a href="../plugins/todo/">PlayerTodo</a></td>
146146
<td>Player Fun</td>
147147
<td>Small per-player todo lists stored in shared playerdata so players do not have to mail notes to themselves.</td>
148-
<td><code>/todo</code>, <code>/todo &lt;text&gt;</code>, <code>/todo add &lt;text&gt;</code>, <code>/todo list [open|all|completed] [page] [asc|desc]</code>, <a href="../plugins/todo/">+14 more</a></td>
148+
<td><code>/todo</code>, <code>/todo &lt;text&gt;</code>, <code>/todo add &lt;text&gt;</code>, <code>/todo list [open|<wbr />all|<wbr />completed] [page] [asc|<wbr />desc]</code>, <a href="../plugins/todo/">+14 more</a></td>
149149
</tr>
150150
<tr>
151151
<td><a href="../plugins/refer/">Refer</a></td>

src/content/docs/player-guides/plugins/afkshrine.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Start in-game with /afkshrine. The sections below explain what AFKShrine is for,
2727

2828
## Commands
2929

30-
<table>
30+
<table class="command-table plugin-command-table">
3131
<thead>
3232
<tr>
3333
<th>Command</th>
@@ -82,7 +82,7 @@ Start in-game with /afkshrine. The sections below explain what AFKShrine is for,
8282
<td><code>/afkshrine quests</code></td>
8383
</tr>
8484
<tr>
85-
<td><code>/afkshrine top [daily|weekly|monthly|lifetime]</code></td>
85+
<td><code>/afkshrine top [daily|<wbr />weekly|<wbr />monthly|<wbr />lifetime]</code></td>
8686
<td>Shows the AFKShrine leaderboard or top list.</td>
8787
<td><code>/afkshrine top</code></td>
8888
</tr>

src/content/docs/player-guides/plugins/birthdaylanterns.mdx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Lantern items are marked with server item data. A normal right-click opens the B
3030

3131
## Commands
3232

33-
<table>
33+
<table class="command-table plugin-command-table">
3434
<thead>
3535
<tr>
3636
<th>Command</th>
@@ -50,27 +50,27 @@ Lantern items are marked with server item data. A normal right-click opens the B
5050
<td><code>/birthday status</code></td>
5151
</tr>
5252
<tr>
53-
<td><code>/birthday set &lt;month day|MM-DD|YYYY-MM-DD&gt;</code></td>
53+
<td><code>/birthday set &lt;month day|<wbr />MM-DD|<wbr />YYYY-MM-DD&gt;</code></td>
5454
<td>Sets one of your BirthdayLanterns preferences.</td>
5555
<td><code>/birthday set 03-07</code></td>
5656
</tr>
5757
<tr>
58-
<td><code>/birthday visibility &lt;private|public&gt;</code></td>
58+
<td><code>/birthday visibility &lt;private|<wbr />public&gt;</code></td>
5959
<td>Changes whether this information is private or public.</td>
6060
<td><code>/birthday visibility public</code></td>
6161
</tr>
6262
<tr>
63-
<td><code>/birthday effects &lt;on|off&gt;</code></td>
63+
<td><code>/birthday effects &lt;on|<wbr />off&gt;</code></td>
6464
<td>Turns cosmetic effects on or off.</td>
6565
<td><code>/birthday effects on</code></td>
6666
</tr>
6767
<tr>
68-
<td><code>/birthday greetings &lt;on|off|send&gt;</code></td>
68+
<td><code>/birthday greetings &lt;on|<wbr />off|<wbr />send&gt;</code></td>
6969
<td>Changes or sends your celebration greetings.</td>
7070
<td><code>/birthday greetings on</code></td>
7171
</tr>
7272
<tr>
73-
<td><code>/birthday presets &lt;particle|sound&gt; &lt;preset|default&gt;</code></td>
73+
<td><code>/birthday presets &lt;particle|<wbr />sound&gt; &lt;preset|<wbr />default&gt;</code></td>
7474
<td>Changes your particle or sound preset.</td>
7575
<td><code>/birthday presets particle sparkle</code></td>
7676
</tr>
@@ -85,7 +85,7 @@ Lantern items are marked with server item data. A normal right-click opens the B
8585
<td><code>/birthday mail birthday-1</code></td>
8686
</tr>
8787
<tr>
88-
<td><code>/birthday guestbook [year|page]</code></td>
88+
<td><code>/birthday guestbook [year|<wbr />page]</code></td>
8989
<td>Views or adds a friendly guestbook message.</td>
9090
<td><code>/birthday guestbook</code></td>
9191
</tr>

src/content/docs/player-guides/plugins/boosters.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Start in-game with /rate. The sections below explain what Boosters is for, which
2828

2929
## Commands
3030

31-
<table>
31+
<table class="command-table plugin-command-table">
3232
<thead>
3333
<tr>
3434
<th>Command</th>

src/content/docs/player-guides/plugins/discordchat.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Start in-game with /discordchat. The sections below explain what DiscordChat is
2727

2828
## Commands
2929

30-
<table>
30+
<table class="command-table plugin-command-table">
3131
<thead>
3232
<tr>
3333
<th>Command</th>
@@ -47,7 +47,7 @@ Start in-game with /discordchat. The sections below explain what DiscordChat is
4747
<td><code>/discordchat status</code></td>
4848
</tr>
4949
<tr>
50-
<td><code>/discordchat top [points|streak|messages|words|emotes]</code></td>
50+
<td><code>/discordchat top [points|<wbr />streak|<wbr />messages|<wbr />words|<wbr />emotes]</code></td>
5151
<td>Shows the top 10 DiscordChat profiles for a public metric.</td>
5252
<td><code>/discordchat top</code></td>
5353
</tr>
@@ -92,12 +92,12 @@ Start in-game with /discordchat. The sections below explain what DiscordChat is
9292
<td><code>/discordchat celebrations</code></td>
9393
</tr>
9494
<tr>
95-
<td><code>/discordchat prefix &lt;preset|off&gt;</code></td>
95+
<td><code>/discordchat prefix &lt;preset|<wbr />off&gt;</code></td>
9696
<td>Selects an unlocked DiscordChat prefix placeholder preset.</td>
9797
<td><code>/discordchat prefix sparkle</code></td>
9898
</tr>
9999
<tr>
100-
<td><code>/discordchat suffix &lt;preset|off&gt;</code></td>
100+
<td><code>/discordchat suffix &lt;preset|<wbr />off&gt;</code></td>
101101
<td>Selects an unlocked DiscordChat suffix placeholder preset.</td>
102102
<td><code>/discordchat suffix sparkle</code></td>
103103
</tr>

src/content/docs/player-guides/plugins/emotemenu.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Start in-game with /emotes. The sections below explain what Emotes is for, which
3333

3434
## Commands
3535

36-
<table>
36+
<table class="command-table plugin-command-table">
3737
<thead>
3838
<tr>
3939
<th>Command</th>

src/content/docs/player-guides/plugins/gametypes.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Start in-game with /gametype. The sections below explain what GameTypes is for,
2727

2828
## Commands
2929

30-
<table>
30+
<table class="command-table plugin-command-table">
3131
<thead>
3232
<tr>
3333
<th>Command</th>

src/content/docs/player-guides/plugins/index.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Each page introduces a feature in normal player language, then shows useful comm
2525
<td><a href="./recordingmode/">RecordingMode</a></td>
2626
<td>Player Fun</td>
2727
<td>Quiet selected personal messages and requests while recording or streaming.</td>
28-
<td><code>/recording</code>, <code>/recording status</code>, <code>/recording help</code>, <code>/recording set msg &lt;on|off&gt;</code>, <a href="./recordingmode/">+7 more</a></td>
28+
<td><code>/recording</code>, <code>/recording status</code>, <code>/recording help</code>, <code>/recording set msg &lt;on|<wbr />off&gt;</code>, <a href="./recordingmode/">+7 more</a></td>
2929
</tr>
3030
<tr>
3131
<td><a href="./sellstreaks/">SellStreaks</a></td>
@@ -67,7 +67,7 @@ Each page introduces a feature in normal player language, then shows useful comm
6767
<td><a href="./kitstreaks/">KitStreaks</a></td>
6868
<td>Player Fun</td>
6969
<td>Track kit claim streaks, milestone calendars, and reward progress.</td>
70-
<td><code>/kitstreak info</code>, <code>/kitstreak status [track|kit:&lt;kit&gt;]</code>, <code>/kitstreak tracks [page]</code>, <code>/kitstreak kits [page]</code>, <a href="./kitstreaks/">+4 more</a></td>
70+
<td><code>/kitstreak info</code>, <code>/kitstreak status [track|<wbr />kit:&lt;kit&gt;]</code>, <code>/kitstreak tracks [page]</code>, <code>/kitstreak kits [page]</code>, <a href="./kitstreaks/">+4 more</a></td>
7171
</tr>
7272
<tr>
7373
<td><a href="./messagefont/">MessageFont</a></td>
@@ -121,7 +121,7 @@ Each page introduces a feature in normal player language, then shows useful comm
121121
<td><a href="./discordchat/">DiscordChat</a></td>
122122
<td>Player Fun</td>
123123
<td>Player guide for DiscordChat, with commands, examples, and basic usage notes.</td>
124-
<td><code>/discordchat</code>, <code>/discordchat status</code>, <code>/discordchat top [points|streak|messages|words|emotes]</code>, <code>/discordchat pulse</code>, <a href="./discordchat/">+9 more</a></td>
124+
<td><code>/discordchat</code>, <code>/discordchat status</code>, <code>/discordchat top [points|<wbr />streak|<wbr />messages|<wbr />words|<wbr />emotes]</code>, <code>/discordchat pulse</code>, <a href="./discordchat/">+9 more</a></td>
125125
</tr>
126126
<tr>
127127
<td><a href="./gametypes/">GameTypes</a></td>
@@ -133,7 +133,7 @@ Each page introduces a feature in normal player language, then shows useful comm
133133
<td><a href="./birthdaylanterns/">BirthdayLanterns</a></td>
134134
<td>Player Fun</td>
135135
<td>Player guide for BirthdayLanterns, with commands, examples, and basic usage notes.</td>
136-
<td><code>/birthday</code>, <code>/birthday status</code>, <code>/birthday set &lt;month day|MM-DD|YYYY-MM-DD&gt;</code>, <code>/birthday visibility &lt;private|public&gt;</code>, <a href="./birthdaylanterns/">+9 more</a></td>
136+
<td><code>/birthday</code>, <code>/birthday status</code>, <code>/birthday set &lt;month day|<wbr />MM-DD|<wbr />YYYY-MM-DD&gt;</code>, <code>/birthday visibility &lt;private|<wbr />public&gt;</code>, <a href="./birthdaylanterns/">+9 more</a></td>
137137
</tr>
138138
<tr>
139139
<td><a href="./mobhat/">MobHat</a></td>
@@ -145,7 +145,7 @@ Each page introduces a feature in normal player language, then shows useful comm
145145
<td><a href="./todo/">PlayerTodo</a></td>
146146
<td>Player Fun</td>
147147
<td>Small per-player todo lists stored in shared playerdata so players do not have to mail notes to themselves.</td>
148-
<td><code>/todo</code>, <code>/todo &lt;text&gt;</code>, <code>/todo add &lt;text&gt;</code>, <code>/todo list [open|all|completed] [page] [asc|desc]</code>, <a href="./todo/">+14 more</a></td>
148+
<td><code>/todo</code>, <code>/todo &lt;text&gt;</code>, <code>/todo add &lt;text&gt;</code>, <code>/todo list [open|<wbr />all|<wbr />completed] [page] [asc|<wbr />desc]</code>, <a href="./todo/">+14 more</a></td>
149149
</tr>
150150
<tr>
151151
<td><a href="./refer/">Refer</a></td>

0 commit comments

Comments
 (0)