Skip to content

Commit 8086742

Browse files
authored
fix: tweak markdown style stripping logic (#709)
* fix #694 * fix slugs * sync docs * fix link * fix links
1 parent 8d2e9e5 commit 8086742

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

apps/svelte.dev/content/blog/2024-04-01-whats-new-in-svelte-april-2024.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Also, this month, a ton of new features have been merged into Svelte 5 to make i
2828
- `adapter-vercel` now has Skew Protection which ensures that the client and server stay in sync for any particular deployment (**@sveltejs/adapter-vercel@5.2.0**, [Docs](https://vercel.com/docs/deployments/skew-protection), [#11987](https://github.com/sveltejs/kit/pull/11987))
2929
- `adapter-vercel`'s build output files now include framework metadata - improving observability on the platform (**@sveltejs/adapter-vercel@5.2.0**, [#11800](https://github.com/sveltejs/kit/pull/11800))
3030
- `adapter-cloudflare` and `adapter-cloudflare-workers` now implement `adapter.emulate` which allows the adapter to emulate the Cloudflare platform during dev and preview ([#11732](https://github.com/sveltejs/kit/pull/11732))
31-
- **Breaking:** `adapter-node` now shuts down gracefully and supports the new `IDLE_TIMEOUT` and `SHUTDOWN_TIMEOUT` environment variables (**@sveltejs/adapter-node@5.0.1**, [Docs](/docs/kit/adapter-node#Environment-variables-SHUTDOWN-TIMEOUT), [#11653](https://github.com/sveltejs/kit/pull/11653))
31+
- **Breaking:** `adapter-node` now shuts down gracefully and supports the new `IDLE_TIMEOUT` and `SHUTDOWN_TIMEOUT` environment variables (**@sveltejs/adapter-node@5.0.1**, [Docs](/docs/kit/adapter-node#Environment-variables-SHUTDOWN_TIMEOUT), [#11653](https://github.com/sveltejs/kit/pull/11653))
3232
- **Breaking:** The default value of `precompress` in `adapter-node` is now `true` - making sites faster by default (**@sveltejs/adapter-node@5.0.0**, [Docs](/docs/kit/adapter-node#Options-precompress), [#11945](https://github.com/sveltejs/kit/pull/11945))
3333
- Google Cloud is now supported in `adapter-auto` without any additional configuration (**@sveltejs/adapter-auto@3.2.0**, [Docs](/docs/kit/adapter-auto), [#12015](https://github.com/sveltejs/kit/pull/12015))
3434

apps/svelte.dev/content/blog/2024-07-01-whats-new-in-svelte-july-2024.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Below, you'll find the highlights from the Svelte 5 release notes (now in [Relea
2424

2525
The node and Cloudflare adapters got a few upgrades this month:
2626

27-
- The `BODY_SIZE_LIMIT` environment variable adds unit suffixes support to the adapter-node - making it easier to write and comprehend large byte values (**[email protected]**, [Docs](/docs/kit/adapter-node#Environment-variables-BODYSIZELIMIT), [#11680](https://github.com/sveltejs/kit/pull/11680))
27+
- The `BODY_SIZE_LIMIT` environment variable adds unit suffixes support to the adapter-node - making it easier to write and comprehend large byte values (**[email protected]**, [Docs](/docs/kit/adapter-node#Environment-variables-BODY_SIZE_LIMIT), [#11680](https://github.com/sveltejs/kit/pull/11680))
2828
- Node servers can now listen to the `sveltekit:shutdown` event (replacing the more abrupt `exit`) that is emitted after the HTTP server has closed all connections (**[email protected]**, [Docs](/docs/kit/adapter-node#Graceful-shutdown), [#12153](https://github.com/sveltejs/kit/pull/12153))
2929
- The Cloudflare adapter will now only throw a `_routes.json` error when the file exists but there are no configured routes in svelte.config (**[email protected]**, [#12360](https://github.com/sveltejs/kit/pull/12360))
3030

apps/svelte.dev/content/docs/kit/25-build-and-deploy/40-adapter-node.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ By default `adapter-node` gracefully shuts down the HTTP server when a `SIGTERM`
187187

188188
1. reject new requests ([`server.close`](https://nodejs.org/api/http.html#serverclosecallback))
189189
2. wait for requests that have already been made but not received a response yet to finish and close connections once they become idle ([`server.closeIdleConnections`](https://nodejs.org/api/http.html#servercloseidleconnections))
190-
3. and finally, close any remaining connections that are still active after [`SHUTDOWN_TIMEOUT`](#Environment-variables-SHUTDOWN-TIMEOUT) seconds. ([`server.closeAllConnections`](https://nodejs.org/api/http.html#servercloseallconnections))
190+
3. and finally, close any remaining connections that are still active after [`SHUTDOWN_TIMEOUT`](#Environment-variables-SHUTDOWN_TIMEOUT) seconds. ([`server.closeAllConnections`](https://nodejs.org/api/http.html#servercloseallconnections))
191191

192192
> [!NOTE] If you want to customize this behaviour you can use a [custom server](#Custom-server).
193193
@@ -205,7 +205,7 @@ The parameter `reason` has one of the following values:
205205

206206
- `SIGINT` - shutdown was triggered by a `SIGINT` signal
207207
- `SIGTERM` - shutdown was triggered by a `SIGTERM` signal
208-
- `IDLE` - shutdown was triggered by [`IDLE_TIMEOUT`](#Environment-variables-IDLE-TIMEOUT)
208+
- `IDLE` - shutdown was triggered by [`IDLE_TIMEOUT`](#Environment-variables-IDLE_TIMEOUT)
209209

210210
## Socket activation
211211

@@ -215,7 +215,7 @@ Most Linux operating systems today use a modern process manager called systemd t
215215
216216
To take advantage of socket activation follow these steps.
217217

218-
1. Run your app as a [systemd service](https://www.freedesktop.org/software/systemd/man/latest/systemd.service.html). It can either run directly on the host system or inside a container (using Docker or a systemd portable service for example). If you additionally pass an [`IDLE_TIMEOUT`](#Environment-variables-IDLE-TIMEOUT) environment variable to your app it will gracefully shutdown if there are no requests for `IDLE_TIMEOUT` seconds. systemd will automatically start your app again when new requests are coming in.
218+
1. Run your app as a [systemd service](https://www.freedesktop.org/software/systemd/man/latest/systemd.service.html). It can either run directly on the host system or inside a container (using Docker or a systemd portable service for example). If you additionally pass an [`IDLE_TIMEOUT`](#Environment-variables-IDLE_TIMEOUT) environment variable to your app it will gracefully shutdown if there are no requests for `IDLE_TIMEOUT` seconds. systemd will automatically start your app again when new requests are coming in.
219219

220220
```ini
221221
/// file: /etc/systemd/system/myapp.service

packages/site-kit/src/lib/markdown/utils.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ export const SHIKI_LANGUAGE_MAP = {
1919
*/
2020
export function clean(markdown: string) {
2121
return markdown
22-
.replace(/\*\*(.+?)\*\*/g, '$1') // bold
23-
.replace(/_(.+?)_/g, '$1') // Italics
24-
.replace(/\*(.+?)\*/g, '$1') // Italics
25-
.replace(/`(.+?)`/g, '$1') // Inline code
26-
.replace(/~~(.+?)~~/g, '$1') // Strikethrough
22+
.replace(/(?:^|b)\*\*(.+?)\*\*(?:\b|$)/g, '$1') // bold
23+
.replace(/(?:^|b)_(.+?)_(?:\b|$)/g, '$1') // Italics
24+
.replace(/(?:^|b)\*(.+?)\*(?:\b|$)/g, '$1') // Italics
25+
.replace(/(?:^|b)`(.+?)`(?:\b|$)/g, '$1') // Inline code
26+
.replace(/(?:^|b)~~(.+?)~~(?:\b|$)/g, '$1') // Strikethrough
2727
.replace(/\[(.+?)\]\(.+?\)/g, '$1') // Link
2828
.replace(/\n/g, ' ') // New line
2929
.replace(/ {2,}/g, ' ')
@@ -36,7 +36,7 @@ export const slugify = (str: string) => {
3636
.replace(/&.+?;/g, '')
3737
.replace(/<\/?.+?>/g, '')
3838
.replace(/\.\.\./g, '')
39-
.replace(/[^a-zA-Z0-9-$(.):']/g, '-')
39+
.replace(/[^a-zA-Z0-9-$(.):'_]/g, '-')
4040
.replace(/-{2,}/g, '-')
4141
.replace(/^-/, '')
4242
.replace(/-$/, '');

0 commit comments

Comments
 (0)