Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tweak markdown style stripping logic #709

Merged
merged 7 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Also, this month, a ton of new features have been merged into Svelte 5 to make i
- `adapter-vercel` now has Skew Protection which ensures that the client and server stay in sync for any particular deployment (**@sveltejs/[email protected]**, [Docs](https://vercel.com/docs/deployments/skew-protection), [#11987](https://github.com/sveltejs/kit/pull/11987))
- `adapter-vercel`'s build output files now include framework metadata - improving observability on the platform (**@sveltejs/[email protected]**, [#11800](https://github.com/sveltejs/kit/pull/11800))
- `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))
- **Breaking:** `adapter-node` now shuts down gracefully and supports the new `IDLE_TIMEOUT` and `SHUTDOWN_TIMEOUT` environment variables (**@sveltejs/[email protected]**, [Docs](/docs/kit/adapter-node#Environment-variables-SHUTDOWN-TIMEOUT), [#11653](https://github.com/sveltejs/kit/pull/11653))
- **Breaking:** `adapter-node` now shuts down gracefully and supports the new `IDLE_TIMEOUT` and `SHUTDOWN_TIMEOUT` environment variables (**@sveltejs/[email protected]**, [Docs](/docs/kit/adapter-node#Environment-variables-SHUTDOWN_TIMEOUT), [#11653](https://github.com/sveltejs/kit/pull/11653))
- **Breaking:** The default value of `precompress` in `adapter-node` is now `true` - making sites faster by default (**@sveltejs/[email protected]**, [Docs](/docs/kit/adapter-node#Options-precompress), [#11945](https://github.com/sveltejs/kit/pull/11945))
- Google Cloud is now supported in `adapter-auto` without any additional configuration (**@sveltejs/[email protected]**, [Docs](/docs/kit/adapter-auto), [#12015](https://github.com/sveltejs/kit/pull/12015))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Below, you'll find the highlights from the Svelte 5 release notes (now in [Relea

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

- 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))
- 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))
- 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))
- 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))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ By default `adapter-node` gracefully shuts down the HTTP server when a `SIGTERM`

1. reject new requests ([`server.close`](https://nodejs.org/api/http.html#serverclosecallback))
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))
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))
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))

> [!NOTE] If you want to customize this behaviour you can use a [custom server](#Custom-server).

Expand All @@ -205,7 +205,7 @@ The parameter `reason` has one of the following values:

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

## Socket activation

Expand All @@ -215,7 +215,7 @@ Most Linux operating systems today use a modern process manager called systemd t

To take advantage of socket activation follow these steps.

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.
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.

```ini
/// file: /etc/systemd/system/myapp.service
Expand Down
12 changes: 6 additions & 6 deletions packages/site-kit/src/lib/markdown/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ export const SHIKI_LANGUAGE_MAP = {
*/
export function clean(markdown: string) {
return markdown
.replace(/\*\*(.+?)\*\*/g, '$1') // bold
.replace(/_(.+?)_/g, '$1') // Italics
.replace(/\*(.+?)\*/g, '$1') // Italics
.replace(/`(.+?)`/g, '$1') // Inline code
.replace(/~~(.+?)~~/g, '$1') // Strikethrough
.replace(/(?:^|b)\*\*(.+?)\*\*(?:\b|$)/g, '$1') // bold
.replace(/(?:^|b)_(.+?)_(?:\b|$)/g, '$1') // Italics
.replace(/(?:^|b)\*(.+?)\*(?:\b|$)/g, '$1') // Italics
.replace(/(?:^|b)`(.+?)`(?:\b|$)/g, '$1') // Inline code
.replace(/(?:^|b)~~(.+?)~~(?:\b|$)/g, '$1') // Strikethrough
.replace(/\[(.+?)\]\(.+?\)/g, '$1') // Link
.replace(/\n/g, ' ') // New line
.replace(/ {2,}/g, ' ')
Expand All @@ -36,7 +36,7 @@ export const slugify = (str: string) => {
.replace(/&.+?;/g, '')
.replace(/<\/?.+?>/g, '')
.replace(/\.\.\./g, '')
.replace(/[^a-zA-Z0-9-$(.):']/g, '-')
.replace(/[^a-zA-Z0-9-$(.):'_]/g, '-')
.replace(/-{2,}/g, '-')
.replace(/^-/, '')
.replace(/-$/, '');
Expand Down
Loading