Skip to content

Commit 0c74098

Browse files
committed
Revert "separate code spans"
This reverts commit 7ce30c0.
1 parent 7ce30c0 commit 0c74098

File tree

13 files changed

+132
-59
lines changed

13 files changed

+132
-59
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ Each route directory contains one or more _route files_, which can be identified
1414

1515
We'll introduce these files in a moment in more detail, but here are a few simple rules to help you remember how SvelteKit's routing works:
1616

17-
- All files can run on the server
18-
- All files run on the client except `+server` files
19-
- `+layout` and `+error` files apply to subdirectories as well as the directory they live in
17+
* All files can run on the server
18+
* All files run on the client except `+server` files
19+
* `+layout` and `+error` files apply to subdirectories as well as the directory they live in
2020

2121
## +page
2222

@@ -291,7 +291,7 @@ If an error is thrown (either `error(...)` or an unexpected error), the response
291291
292292
### Receiving data
293293
294-
By exporting `POST` / `PUT` / `PATCH` / `DELETE` / `OPTIONS` / `HEAD` handlers, `+server.js` files can be used to create a complete API:
294+
By exporting `POST`/`PUT`/`PATCH`/`DELETE`/`OPTIONS`/`HEAD` handlers, `+server.js` files can be used to create a complete API:
295295
296296
```svelte
297297
<!--- file: src/routes/add/+page.svelte --->
@@ -362,8 +362,8 @@ export async function fallback({ request }) {
362362
363363
`+server.js` files can be placed in the same directory as `+page` files, allowing the same route to be either a page or an API endpoint. To determine which, SvelteKit applies the following rules:
364364
365-
- `PUT` / `PATCH` / `DELETE` / `OPTIONS` requests are always handled by `+server.js` since they do not apply to pages
366-
- `GET` / `POST` / `HEAD` requests are treated as page requests if the `accept` header prioritises `text/html` (in other words, it's a browser page request), else they are handled by `+server.js`.
365+
- `PUT`/`PATCH`/`DELETE`/`OPTIONS` requests are always handled by `+server.js` since they do not apply to pages
366+
- `GET`/`POST`/`HEAD` requests are treated as page requests if the `accept` header prioritises `text/html` (in other words, it's a browser page request), else they are handled by `+server.js`.
367367
- Responses to `GET` requests will include a `Vary: Accept` header, so that proxies and browsers cache HTML and JSON responses separately.
368368
369369
## $types

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ Some forms don't need to `POST` data to the server — search inputs, for exampl
509509
<form action="/search">
510510
<label>
511511
Search
512-
<input name="q" />
512+
<input name="q">
513513
</label>
514514
</form>
515515
```

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

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ If you encounter an error like 'The following routes were marked as prerenderabl
8080

8181
Since these routes cannot be dynamically server-rendered, this will cause errors when people try to access the route in question. There are a few ways to fix it:
8282

83-
- Ensure that SvelteKit can find the route by following links from [`config.kit.prerender.entries`](configuration#prerender) or the [`entries`](#entries) page option. Add links to dynamic routes (i.e. pages with `[parameters]` ) to this option if they are not found through crawling the other entry points, else they are not prerendered because SvelteKit doesn't know what value the parameters should have. Pages not marked as prerenderable will be ignored and their links to other pages will not be crawled, even if some of them would be prerenderable.
84-
- Ensure that SvelteKit can find the route by discovering a link to it from one of your other prerendered pages that have server-side rendering enabled.
85-
- Change `export const prerender = true` to `export const prerender = 'auto'`. Routes with `'auto'` can be dynamically server rendered
83+
* Ensure that SvelteKit can find the route by following links from [`config.kit.prerender.entries`](configuration#prerender) or the [`entries`](#entries) page option. Add links to dynamic routes (i.e. pages with `[parameters]` ) to this option if they are not found through crawling the other entry points, else they are not prerendered because SvelteKit doesn't know what value the parameters should have. Pages not marked as prerenderable will be ignored and their links to other pages will not be crawled, even if some of them would be prerenderable.
84+
* Ensure that SvelteKit can find the route by discovering a link to it from one of your other prerendered pages that have server-side rendering enabled.
85+
* Change `export const prerender = true` to `export const prerender = 'auto'`. Routes with `'auto'` can be dynamically server rendered
8686

8787
## entries
8888

@@ -104,7 +104,10 @@ This can be done with [`config.kit.prerender.entries`](configuration#prerender),
104104
/// file: src/routes/blog/[slug]/+page.server.js
105105
/** @type {import('./$types').EntryGenerator} */
106106
export function entries() {
107-
return [{ slug: 'hello-world' }, { slug: 'another-blog-post' }];
107+
return [
108+
{ slug: 'hello-world' },
109+
{ slug: 'another-blog-post' }
110+
];
108111
}
109112

110113
export const prerender = true;
@@ -136,11 +139,11 @@ export const csr = false;
136139

137140
Disabling CSR does not ship any JavaScript to the client. This means:
138141

139-
- The webpage should work with HTML and CSS only.
140-
- `<script>` tags inside all Svelte components are removed.
141-
- `<form>` elements cannot be [progressively enhanced](form-actions#Progressive-enhancement).
142-
- Links are handled by the browser with a full-page navigation.
143-
- Hot Module Replacement (HMR) will be disabled.
142+
* The webpage should work with HTML and CSS only.
143+
* `<script>` tags inside all Svelte components are removed.
144+
* `<form>` elements cannot be [progressively enhanced](form-actions#Progressive-enhancement).
145+
* Links are handled by the browser with a full-page navigation.
146+
* Hot Module Replacement (HMR) will be disabled.
144147

145148
You can enable `csr` during development (for example to take advantage of HMR) like so:
146149

@@ -197,7 +200,7 @@ export const config = {
197200
foo: {
198201
bar: true
199202
}
200-
};
203+
}
201204
```
202205

203206
...is overridden by this page configuration...
@@ -209,7 +212,7 @@ export const config = {
209212
foo: {
210213
baz: true
211214
}
212-
};
215+
}
213216
```
214217

215218
...which results in the config value `{ runtime: 'edge', regions: ['us1', 'us2'], foo: { baz: true } }` for that page.

apps/svelte.dev/content/docs/kit/30-advanced/40-service-workers.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const CACHE = `cache-${version}`;
3232

3333
const ASSETS = [
3434
...build, // the app itself
35-
...files // everything in `static`
35+
...files // everything in `static`
3636
];
3737

3838
self.addEventListener('install', (event) => {
@@ -64,7 +64,7 @@ self.addEventListener('fetch', (event) => {
6464
const url = new URL(event.request.url);
6565
const cache = await caches.open(CACHE);
6666

67-
// `build` / `files` can always be served from the cache
67+
// `build`/`files` can always be served from the cache
6868
if (ASSETS.includes(url.pathname)) {
6969
const response = await cache.match(url.pathname);
7070

@@ -134,7 +134,6 @@ Setting up proper types for service workers requires some manual setup. Inside y
134134
135135
const sw = /** @type {ServiceWorkerGlobalScope} */ (/** @type {unknown} */ (self));
136136
```
137-
138137
```generated-ts
139138
/// <reference types="@sveltejs/kit" />
140139
/// <reference no-default-lib="true"/>

apps/svelte.dev/content/docs/kit/30-advanced/70-packaging.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,10 @@ If your package has files with side effects, you can specify them in an array:
146146
```json
147147
/// file: package.json
148148
{
149-
"sideEffects": ["**/*.css", "./dist/sideEffectfulFile.js"]
149+
"sideEffects": [
150+
"**/*.css",
151+
"./dist/sideEffectfulFile.js"
152+
]
150153
}
151154
```
152155

@@ -219,10 +222,10 @@ You should think carefully about whether or not the changes you make to your pac
219222

220223
`svelte-package` accepts the following options:
221224

222-
- `-w` / `--watch` — watch files in `src/lib` for changes and rebuild the package
223-
- `-i` / `--input` — the input directory which contains all the files of the package. Defaults to `src/lib`
224-
- `-o` / `--output` — the output directory where the processed files are written to. Your `package.json`'s `exports` should point to files inside there, and the `files` array should include that folder. Defaults to `dist`
225-
- `-t` / `--types` — whether or not to create type definitions (`d.ts` files). We strongly recommend doing this as it fosters ecosystem library quality. Defaults to `true`
225+
- `-w`/`--watch` — watch files in `src/lib` for changes and rebuild the package
226+
- `-i`/`--input` — the input directory which contains all the files of the package. Defaults to `src/lib`
227+
- `-o`/`--output` — the output directory where the processed files are written to. Your `package.json`'s `exports` should point to files inside there, and the `files` array should include that folder. Defaults to `dist`
228+
- `-t`/`--types` — whether or not to create type definitions (`d.ts` files). We strongly recommend doing this as it fosters ecosystem library quality. Defaults to `true`
226229
- `--tsconfig` - the path to a tsconfig or jsconfig. When not provided, searches for the next upper tsconfig/jsconfig in the workspace path.
227230

228231
## Publishing

apps/svelte.dev/content/docs/kit/40-best-practices/20-seo.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ const config = {
7575
export default config;
7676
```
7777

78-
...disabling `csr` in your root `+layout.js` / `+layout.server.js`...
78+
...disabling `csr` in your root `+layout.js`/`+layout.server.js`...
7979

8080
```js
8181
/// file: src/routes/+layout.server.js
@@ -86,8 +86,7 @@ export const csr = false;
8686

8787
```html
8888
<html amp>
89-
...
90-
</html>
89+
...
9190
```
9291

9392
...and transforming the HTML using `transformPageChunk` along with `transform` imported from `@sveltejs/amp`:

apps/svelte.dev/content/docs/kit/60-appendix/10-faq.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ onMount(() => {
142142
```
143143
144144
Finally, you may also consider using an `{#await}` block:
145-
146145
```svelte
147146
<!--- file: index.svelte --->
148147
<script>
@@ -178,7 +177,7 @@ export function GET({ params, url }) {
178177
}
179178
```
180179
181-
(Note that you may also need to proxy `POST` / `PATCH` etc requests, and forward `request.headers`, depending on your needs.)
180+
(Note that you may also need to proxy `POST`/`PATCH` etc requests, and forward `request.headers`, depending on your needs.)
182181
183182
### How do I use middleware?
184183

apps/svelte.dev/content/docs/kit/98-reference/50-configuration.md

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ Any additional options required by tooling that integrates with Svelte.
124124
</div>
125125
</div></div>
126126

127+
128+
127129
## KitConfig
128130

129131
The `kit` property configures SvelteKit, and can have the following properties:
@@ -140,6 +142,8 @@ Your [adapter](https://kit.svelte.dev/docs/adapters) is run when executing `vite
140142

141143
<div class="ts-block-property-children">
142144

145+
146+
143147
</div>
144148

145149
## alias
@@ -180,6 +184,8 @@ const config = {
180184
181185
<div class="ts-block-property-children">
182186

187+
188+
183189
</div>
184190

185191
## appDir
@@ -196,12 +202,16 @@ If `paths.assets` is specified, there will be two app directories — `${paths.a
196202

197203
<div class="ts-block-property-children">
198204

205+
206+
199207
</div>
200208

201209
## csp
202210

203211
<div class="ts-block-property-bullets">
204212

213+
214+
205215
</div>
206216

207217
[Content Security Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy) configuration. CSP helps to protect your users against cross-site scripting (XSS) attacks, by limiting the places resources can be loaded from. For example, a configuration like this...
@@ -288,6 +298,8 @@ Directives that will be added to `Content-Security-Policy-Report-Only` headers.
288298

289299
<div class="ts-block-property-bullets">
290300

301+
302+
291303
</div>
292304

293305
Protection against [cross-site request forgery (CSRF)](https://owasp.org/www-community/attacks/csrf) attacks.
@@ -331,12 +343,16 @@ Note that it is generally not supported to embed multiple SvelteKit apps on the
331343

332344
<div class="ts-block-property-children">
333345

346+
347+
334348
</div>
335349

336350
## env
337351

338352
<div class="ts-block-property-bullets">
339353

354+
355+
340356
</div>
341357

342358
Environment variable configuration
@@ -408,6 +424,8 @@ A prefix that signals that an environment variable is unsafe to expose to client
408424

409425
<div class="ts-block-property-bullets">
410426

427+
428+
411429
</div>
412430

413431
Where to find various files within your project.
@@ -634,6 +652,8 @@ Inline CSS inside a `<style>` block at the head of the HTML. This option is a nu
634652
635653
<div class="ts-block-property-children">
636654

655+
656+
637657
</div>
638658

639659
## moduleExtensions
@@ -648,6 +668,8 @@ An array of file extensions that SvelteKit will treat as modules. Files with ext
648668

649669
<div class="ts-block-property-children">
650670

671+
672+
651673
</div>
652674

653675
## outDir
@@ -662,12 +684,16 @@ The directory that SvelteKit writes files to during `dev` and `build`. You shoul
662684

663685
<div class="ts-block-property-children">
664686

687+
688+
665689
</div>
666690

667691
## output
668692

669693
<div class="ts-block-property-bullets">
670694

695+
696+
671697
</div>
672698

673699
Options related to the build output format
@@ -692,7 +718,6 @@ preloadStrategy?: 'modulepreload' | 'preload-js' | 'preload-mjs';
692718

693719
SvelteKit will preload the JavaScript modules needed for the initial page to avoid import 'waterfalls', resulting in faster application startup. There
694720
are three strategies with different trade-offs:
695-
696721
- `modulepreload` - uses `<link rel="modulepreload">`. This delivers the best results in Chromium-based browsers, in Firefox 115+, and Safari 17+. It is ignored in older browsers.
697722
- `preload-js` - uses `<link rel="preload">`. Prevents waterfalls in Chromium and Safari, but Chromium will parse each module twice (once as a script, once as a module). Causes modules to be requested twice in Firefox. This is a good setting if you want to maximise performance for users on iOS devices at the cost of a very slight degradation for Chromium users.
698723
- `preload-mjs` - uses `<link rel="preload">` but with the `.mjs` extension which prevents double-parsing in Chromium. Some static webservers will fail to serve .mjs files with a `Content-Type: application/javascript` header, which will cause your application to break. If that doesn't apply to you, this is the option that will deliver the best performance for the largest number of users, until `modulepreload` is more widely supported.
@@ -706,8 +731,12 @@ are three strategies with different trade-offs:
706731

707732
<div class="ts-block-property-bullets">
708733

734+
735+
709736
</div>
710737

738+
739+
711740
<div class="ts-block-property-children">
712741

713742
<div class="ts-block-property">
@@ -784,6 +813,8 @@ In 1.0, `undefined` was a valid value, which was set by default. In that case, i
784813

785814
<div class="ts-block-property-bullets">
786815

816+
817+
787818
</div>
788819

789820
See [Prerendering](https://kit.svelte.dev/docs/page-options#prerender).
@@ -843,7 +874,7 @@ entries?: Array<'*' | `/${string}`>;
843874

844875
</div>
845876

846-
An array of pages to prerender, or start crawling from (if `crawl: true`). The `*` string includes all routes containing no required `[parameters]` with optional parameters included as being empty (since SvelteKit doesn't know what value any parameters should have).
877+
An array of pages to prerender, or start crawling from (if `crawl: true`). The `*` string includes all routes containing no required `[parameters]` with optional parameters included as being empty (since SvelteKit doesn't know what value any parameters should have).
847878

848879
</div>
849880
</div>
@@ -969,8 +1000,12 @@ The value of `url.origin` during prerendering; useful if it is included in rende
9691000

9701001
<div class="ts-block-property-bullets">
9711002

1003+
1004+
9721005
</div>
9731006

1007+
1008+
9741009
<div class="ts-block-property-children">
9751010

9761011
<div class="ts-block-property">
@@ -1018,8 +1053,12 @@ Determine which files in your `static` directory will be available in `$service-
10181053
10191054
<div class="ts-block-property-bullets">
10201055
1056+
1057+
10211058
</div>
10221059
1060+
1061+
10231062
<div class="ts-block-property-children">
10241063
10251064
<div class="ts-block-property">
@@ -1050,13 +1089,14 @@ This is useful for extending a shared `tsconfig.json` in a monorepo root, for ex
10501089
10511090
<div class="ts-block-property-bullets">
10521091
1092+
1093+
10531094
</div>
10541095
10551096
Client-side navigation can be buggy if you deploy a new version of your app while people are using it. If the code for the new page is already loaded, it may have stale content; if it isn't, the app's route manifest may point to a JavaScript file that no longer exists.
10561097
SvelteKit helps you solve this problem through version management.
10571098
If SvelteKit encounters an error while loading the page and detects that a new version has been deployed (using the `name` specified here, which defaults to a timestamp of the build) it will fall back to traditional full-page navigation.
10581099
Not all navigations will result in an error though, for example if the JavaScript for the next page is already loaded. If you still want to force a full-page navigation in these cases, use techniques such as setting the `pollInterval` and then using `beforeNavigate`:
1059-
10601100
```html
10611101
/// file: +layout.svelte
10621102
<script>

apps/svelte.dev/content/docs/svelte/02-runes/01-what-are-runes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ title: What are runes?
66
>
77
> A letter or mark used as a mystical or magic symbol.
88
9-
Runes are symbols that you use in `.svelte` and `.svelte.js` / `.svelte.ts` files to control the Svelte compiler. If you think of Svelte as a language, runes are part of the syntax — they are _keywords_.
9+
Runes are symbols that you use in `.svelte` and `.svelte.js`/`.svelte.ts` files to control the Svelte compiler. If you think of Svelte as a language, runes are part of the syntax — they are _keywords_.
1010

1111
Runes have a `$` prefix and look like functions:
1212

0 commit comments

Comments
 (0)