Skip to content

Commit a29dc72

Browse files
authored
Annotate blockquote notes with [!NOTE] (#334)
* differentiate between notes and non-note blockquotes * fix css * annotate blockquotes
1 parent b0ac2c9 commit a29dc72

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+122
-112
lines changed

apps/svelte.dev/content/docs/kit/10-getting-started/10-introduction.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: Introduction
44

55
## Before we begin
66

7-
> If you're new to Svelte or SvelteKit we recommend checking out the [interactive tutorial](https://learn.svelte.dev).
7+
> [!NOTE] If you're new to Svelte or SvelteKit we recommend checking out the [interactive tutorial](https://learn.svelte.dev).
88
>
99
> If you get stuck, reach out for help in the [Discord chatroom](https://svelte.dev/chat).
1010

apps/svelte.dev/content/docs/kit/10-getting-started/40-web-standards.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ In particular, you'll get comfortable with the following:
1212

1313
SvelteKit uses [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/fetch) for getting data from the network. It's available in [hooks](hooks) and [server routes](routing#server) as well as in the browser.
1414

15-
> A special version of `fetch` is available in [`load`](load) functions, [server hooks](hooks#server-hooks) and [API routes](routing#server) for invoking endpoints directly during server-side rendering, without making an HTTP call, while preserving credentials. (To make credentialled fetches in server-side code outside `load`, you must explicitly pass `cookie` and/or `authorization` headers.) It also allows you to make relative requests, whereas server-side `fetch` normally requires a fully qualified URL.
15+
> [!NOTE] A special version of `fetch` is available in [`load`](load) functions, [server hooks](hooks#server-hooks) and [API routes](routing#server) for invoking endpoints directly during server-side rendering, without making an HTTP call, while preserving credentials. (To make credentialled fetches in server-side code outside `load`, you must explicitly pass `cookie` and/or `authorization` headers.) It also allows you to make relative requests, whereas server-side `fetch` normally requires a fully qualified URL.
1616
1717
Besides `fetch` itself, the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) includes the following interfaces:
1818

apps/svelte.dev/content/docs/kit/20-core-concepts/10-routing.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ At the heart of SvelteKit is a _filesystem-based router_. The routes of your app
88
- `src/routes/about` creates an `/about` route
99
- `src/routes/blog/[slug]` creates a route with a _parameter_, `slug`, that can be used to load data dynamically when a user requests a page like `/blog/hello-world`
1010

11-
> You can change `src/routes` to a different directory by editing the [project config](configuration).
11+
> [!NOTE] You can change `src/routes` to a different directory by editing the [project config](configuration).
1212
1313
Each route directory contains one or more _route files_, which can be identified by their `+` prefix.
1414

@@ -48,7 +48,7 @@ A `+page.svelte` component defines a page of your app. By default, pages are ren
4848
<div>{@html data.content}</div>
4949
```
5050

51-
> Note that SvelteKit uses `<a>` elements to navigate between routes, rather than a framework-specific `<Link>` component.
51+
> [!NOTE] Note that SvelteKit uses `<a>` elements to navigate between routes, rather than a framework-specific `<Link>` component.
5252
5353
### +page.js
5454

@@ -139,7 +139,7 @@ If the error occurs inside a `load` function in `+layout(.server).js`, the close
139139

140140
If no route can be found (404), `src/routes/+error.svelte` (or the default error page, if that file does not exist) will be used.
141141

142-
> `+error.svelte` is _not_ used when an error occurs inside [`handle`](hooks#server-hooks-handle) or a [+server.js](#server) request handler.
142+
> [!NOTE] `+error.svelte` is _not_ used when an error occurs inside [`handle`](hooks#server-hooks-handle) or a [+server.js](#server) request handler.
143143
144144
You can read more about error handling [here](errors).
145145

@@ -246,7 +246,7 @@ Data returned from a layout's `load` function is also available to all its child
246246
</script>
247247
```
248248

249-
> Often, layout data is unchanged when navigating between pages. SvelteKit will intelligently rerun [`load`](load) functions when necessary.
249+
> [!NOTE] Often, layout data is unchanged when navigating between pages. SvelteKit will intelligently rerun [`load`](load) functions when necessary.
250250
251251
### +layout.server.js
252252

@@ -287,7 +287,7 @@ You can use the [`error`](@sveltejs-kit#error), [`redirect`](@sveltejs-kit#redir
287287
288288
If an error is thrown (either `error(...)` or an unexpected error), the response will be a JSON representation of the error or a fallback error page — which can be customised via `src/error.html` — depending on the `Accept` header. The [`+error.svelte`](#error) component will _not_ be rendered in this case. You can read more about error handling [here](errors).
289289
290-
> When creating an `OPTIONS` handler, note that Vite will inject `Access-Control-Allow-Origin` and `Access-Control-Allow-Methods` headers — these will not be present in production unless you add them.
290+
> [!NOTE] When creating an `OPTIONS` handler, note that Vite will inject `Access-Control-Allow-Origin` and `Access-Control-Allow-Methods` headers — these will not be present in production unless you add them.
291291
292292
### Receiving data
293293
@@ -331,9 +331,9 @@ export async function POST({ request }) {
331331
}
332332
```
333333
334-
> In general, [form actions](form-actions) are a better way to submit data from the browser to the server.
334+
> [!NOTE] In general, [form actions](form-actions) are a better way to submit data from the browser to the server.
335335
336-
> If a `GET` handler is exported, a `HEAD` request will return the `content-length` of the `GET` handler's response body.
336+
> [!NOTE] If a `GET` handler is exported, a `HEAD` request will return the `content-length` of the `GET` handler's response body.
337337
338338
### Fallback method handler
339339
@@ -356,7 +356,7 @@ export async function fallback({ request }) {
356356
}
357357
```
358358
359-
> For `HEAD` requests, the `GET` handler takes precedence over the `fallback` handler.
359+
> [!NOTE] For `HEAD` requests, the `GET` handler takes precedence over the `fallback` handler.
360360
361361
### Content negotiation
362362

apps/svelte.dev/content/docs/kit/20-core-concepts/20-load.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ Data returned from layout `load` functions is available to child `+layout.svelte
132132
+{/if}
133133
```
134134

135-
> If multiple `load` functions return data with the same key, the last one 'wins' — the result of a layout `load` returning `{ a: 1, b: 2 }` and a page `load` returning `{ b: 3, c: 4 }` would be `{ a: 1, b: 3, c: 4 }`.
135+
> [!NOTE] If multiple `load` functions return data with the same key, the last one 'wins' — the result of a layout `load` returning `{ a: 1, b: 2 }` and a page `load` returning `{ b: 3, c: 4 }` would be `{ a: 1, b: 3, c: 4 }`.
136136
137137
## $page.data
138138

@@ -224,7 +224,7 @@ Often the `load` function depends on the URL in one way or another. For this, th
224224

225225
An instance of [`URL`](https://developer.mozilla.org/en-US/docs/Web/API/URL), containing properties like the `origin`, `hostname`, `pathname` and `searchParams` (which contains the parsed query string as a [`URLSearchParams`](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams) object). `url.hash` cannot be accessed during `load`, since it is unavailable on the server.
226226

227-
> In some environments this is derived from request headers during server-side rendering. If you're using [adapter-node](adapter-node), for example, you may need to configure the adapter in order for the URL to be correct.
227+
> [!NOTE] In some environments this is derived from request headers during server-side rendering. If you're using [adapter-node](adapter-node), for example, you may need to configure the adapter in order for the URL to be correct.
228228
229229
### route
230230

@@ -373,7 +373,7 @@ export async function load({ parent }) {
373373
<p>{data.a} + {data.b} = {data.c}</p>
374374
```
375375

376-
> Notice that the `load` function in `+page.js` receives the merged data from both layout `load` functions, not just the immediate parent.
376+
> [!NOTE] Notice that the `load` function in `+page.js` receives the merged data from both layout `load` functions, not just the immediate parent.
377377
378378
Inside `+page.server.js` and `+layout.server.js`, `parent` returns data from parent `+layout.server.js` files.
379379

@@ -432,7 +432,7 @@ Calling `error(...)` will throw an exception, making it easy to stop execution f
432432

433433
If an [_unexpected_](errors#unexpected-errors) error is thrown, SvelteKit will invoke [`handleError`](hooks#shared-hooks-handleerror) and treat it as a 500 Internal Error.
434434

435-
> [In SvelteKit 1.x](migrating-to-sveltekit-2#redirect-and-error-are-no-longer-thrown-by-you) you had to `throw` the error yourself
435+
> [!NOTE] [In SvelteKit 1.x](migrating-to-sveltekit-2#redirect-and-error-are-no-longer-thrown-by-you) you had to `throw` the error yourself
436436
437437
## Redirects
438438

@@ -461,11 +461,11 @@ export function load({ locals }) {
461461
}
462462
```
463463

464-
> Don't use `redirect()` inside a `try {...}` block, as the redirect will immediately trigger the catch statement.
464+
> [!NOTE] Don't use `redirect()` inside a `try {...}` block, as the redirect will immediately trigger the catch statement.
465465
466466
In the browser, you can also navigate programmatically outside of a `load` function using [`goto`]($app-navigation#goto) from [`$app.navigation`]($app-navigation).
467467

468-
> [In SvelteKit 1.x](migrating-to-sveltekit-2#redirect-and-error-are-no-longer-thrown-by-you) you had to `throw` the `redirect` yourself
468+
> [!NOTE] [In SvelteKit 1.x](migrating-to-sveltekit-2#redirect-and-error-are-no-longer-thrown-by-you) you had to `throw` the `redirect` yourself
469469
470470
## Streaming with promises
471471

@@ -534,13 +534,13 @@ export function load({ fetch }) {
534534
}
535535
```
536536

537-
> On platforms that do not support streaming, such as AWS Lambda or Firebase, responses will be buffered. This means the page will only render once all promises resolve. If you are using a proxy (e.g. NGINX), make sure it does not buffer responses from the proxied server.
537+
> [!NOTE] On platforms that do not support streaming, such as AWS Lambda or Firebase, responses will be buffered. This means the page will only render once all promises resolve. If you are using a proxy (e.g. NGINX), make sure it does not buffer responses from the proxied server.
538538
539-
> Streaming data will only work when JavaScript is enabled. You should avoid returning promises from a universal `load` function if the page is server rendered, as these are _not_ streamed — instead, the promise is recreated when the function reruns in the browser.
539+
> [!NOTE] Streaming data will only work when JavaScript is enabled. You should avoid returning promises from a universal `load` function if the page is server rendered, as these are _not_ streamed — instead, the promise is recreated when the function reruns in the browser.
540540
541-
> The headers and status code of a response cannot be changed once the response has started streaming, therefore you cannot `setHeaders` or throw redirects inside a streamed promise.
541+
> [!NOTE] The headers and status code of a response cannot be changed once the response has started streaming, therefore you cannot `setHeaders` or throw redirects inside a streamed promise.
542542
543-
> [In SvelteKit 1.x](migrating-to-sveltekit-2#top-level-promises-are-no-longer-awaited) top-level promises were automatically awaited, only nested promises were streamed.
543+
> [!NOTE] [In SvelteKit 1.x](migrating-to-sveltekit-2#top-level-promises-are-no-longer-awaited) top-level promises were automatically awaited, only nested promises were streamed.
544544
545545
## Parallel loading
546546

apps/svelte.dev/content/docs/kit/20-core-concepts/30-form-actions.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ To invoke this action from the `/login` page, just add a `<form>` — no JavaScr
3939

4040
If someone were to click the button, the browser would send the form data via `POST` request to the server, running the default action.
4141

42-
> Actions always use `POST` requests, since `GET` requests should never have side-effects.
42+
> [!NOTE] Actions always use `POST` requests, since `GET` requests should never have side-effects.
4343
4444
We can also invoke the action from other pages (for example if there's a login widget in the nav in the root layout) by adding the `action` attribute, pointing to the page:
4545

@@ -99,7 +99,7 @@ As well as the `action` attribute, we can use the `formaction` attribute on a bu
9999
</form>
100100
```
101101

102-
> We can't have default actions next to named actions, because if you POST to a named action without a redirect, the query parameter is persisted in the URL, which means the next default POST would go through the named action from before.
102+
> [!NOTE] We can't have default actions next to named actions, because if you POST to a named action without a redirect, the query parameter is persisted in the URL, which means the next default POST would go through the named action from before.
103103
104104
## Anatomy of an action
105105

@@ -184,7 +184,7 @@ export const actions = {
184184
};
185185
```
186186

187-
> Note that as a precaution, we only return the email back to the page — not the password.
187+
> [!NOTE] Note that as a precaution, we only return the email back to the page — not the password.
188188
189189
```diff
190190
/// file: src/routes/login/+page.svelte
@@ -329,7 +329,7 @@ The easiest way to progressively enhance a form is to add the `use:enhance` acti
329329
+<form method="POST" use:enhance>
330330
```
331331

332-
> Yes, it's a little confusing that the `enhance` action and `<form action>` are both called 'action'. These docs are action-packed. Sorry.
332+
> [!NOTE] Yes, it's a little confusing that the `enhance` action and `<form action>` are both called 'action'. These docs are action-packed. Sorry.
333333
334334
Without an argument, `use:enhance` will emulate the browser-native behaviour, just without the full-page reloads. It will:
335335

apps/svelte.dev/content/docs/kit/20-core-concepts/40-page-options.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Routes with `prerender = true` will be excluded from manifests used for dynamic
3131
export const prerender = 'auto';
3232
```
3333

34-
> If your entire app is suitable for prerendering, you can use [`adapter-static`](https://github.com/sveltejs/kit/tree/main/packages/adapter-static), which will output files suitable for use with any static webserver.
34+
> [!NOTE] If your entire app is suitable for prerendering, you can use [`adapter-static`](https://github.com/sveltejs/kit/tree/main/packages/adapter-static), which will output files suitable for use with any static webserver.
3535
3636
The prerenderer will start at the root of your app and generate files for any prerenderable pages or `+server.js` routes it finds. Each page is scanned for `<a>` elements that point to other pages that are candidates for prerendering — because of this, you generally don't need to specify which pages should be accessed. If you _do_ need to specify which pages should be accessed by the prerenderer, you can do so with [`config.kit.prerender.entries`](configuration#prerender), or by exporting an [`entries`](#entries) function from your dynamic route.
3737

@@ -58,7 +58,7 @@ export async function load({ fetch }) {
5858

5959
The basic rule is this: for a page to be prerenderable, any two users hitting it directly must get the same content from the server.
6060

61-
> Not all pages are suitable for prerendering. Any content that is prerendered will be seen by all users. You can of course fetch personalized data in `onMount` in a prerendered page, but this may result in a poorer user experience since it will involve blank initial content or loading indicators.
61+
> [!NOTE] Not all pages are suitable for prerendering. Any content that is prerendered will be seen by all users. You can of course fetch personalized data in `onMount` in a prerendered page, but this may result in a poorer user experience since it will involve blank initial content or loading indicators.
6262
6363
Note that you can still prerender pages that load data based on the page's parameters, such as a `src/routes/blog/[slug]/+page.svelte` route.
6464

@@ -167,7 +167,7 @@ export const trailingSlash = 'always';
167167

168168
This option also affects [prerendering](#prerender). If `trailingSlash` is `always`, a route like `/about` will result in an `about/index.html` file, otherwise it will create `about.html`, mirroring static webserver conventions.
169169

170-
> Ignoring trailing slashes is not recommended — the semantics of relative paths differ between the two cases (`./y` from `/x` is `/y`, but from `/x/` is `/x/y`), and `/x` and `/x/` are treated as separate URLs which is harmful to SEO.
170+
> [!NOTE] Ignoring trailing slashes is not recommended — the semantics of relative paths differ between the two cases (`./y` from `/x` is `/y`, but from `/x/` is `/x/y`), and `/x` and `/x/` are treated as separate URLs which is harmful to SEO.
171171
172172
## config
173173

apps/svelte.dev/content/docs/kit/20-core-concepts/50-state-management.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ Instead, we need to make the value [_reactive_](https://learn.svelte.dev/tutoria
155155
</script>
156156
```
157157

158-
> If your code in `onMount` and `onDestroy` has to run again after navigation you can use [afterNavigate]($app-navigation#afterNavigate) and [beforeNavigate]($app-navigation#beforeNavigate) respectively.
158+
> [!NOTE] If your code in `onMount` and `onDestroy` has to run again after navigation you can use [afterNavigate]($app-navigation#afterNavigate) and [beforeNavigate]($app-navigation#beforeNavigate) respectively.
159159
160160
Reusing components like this means that things like sidebar scroll state are preserved, and you can easily animate between changing values. In the case that you do need to completely destroy and remount a component on navigation, you can use this pattern:
161161

0 commit comments

Comments
 (0)