Skip to content

docs(sites): Normalize svelte compiler headings #8755

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

Merged
merged 2 commits into from
Jun 19, 2023
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 @@ -38,7 +38,7 @@ Svelte uses the `export` keyword to mark a variable declaration as a _property_

You can specify a default initial value for a prop. It will be used if the component's consumer doesn't specify the prop on the component (or if its initial value is `undefined`) when instantiating the component. Note that if the values of props are subsequently updated, then any prop whose value is not specified will be set to `undefined` (rather than its initial value).

In development mode (see the [compiler options](/docs/svelte-compiler#svelte-compile)), a warning will be printed if no default initial value is provided and the consumer does not specify a value. To squelch this warning, ensure that a default initial value is specified, even if it is `undefined`.
In development mode (see the [compiler options](/docs/svelte-compiler#compile)), a warning will be printed if no default initial value is provided and the consumer does not specify a value. To squelch this warning, ensure that a default initial value is specified, even if it is `undefined`.

```svelte
<script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ As with `<svelte:window>`, `<svelte:document>` and `<svelte:body>`, this element
<svelte:options option={value} />
```

The `<svelte:options>` element provides a place to specify per-component compiler options, which are detailed in the [compiler section](/docs/svelte-compiler#svelte-compile). The possible options are:
The `<svelte:options>` element provides a place to specify per-component compiler options, which are detailed in the [compiler section](/docs/svelte-compiler#compile). The possible options are:

- `immutable={true}` — you never use mutable data, so the compiler can do simple referential equality checks to determine if values have changed
- `immutable={false}` — the default. Svelte will be more conservative about whether or not mutable objects have changed
Expand Down
10 changes: 5 additions & 5 deletions documentation/docs/04-compiler-and-api/01-svelte-compiler.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Typically, you won't interact with the Svelte compiler directly, but will instea

Nonetheless, it's useful to understand how to use the compiler, since bundler plugins generally expose compiler options to you.

## `svelte.compile`
## compile

> EXPORT_SNIPPET: svelte/compiler#compile

Expand Down Expand Up @@ -154,7 +154,7 @@ compiled: {

-->

## `svelte.parse`
## parse

> EXPORT_SNIPPET: svelte/compiler#parse

Expand All @@ -175,7 +175,7 @@ import { parse } from 'svelte/compiler';
const ast = parse(source, { filename: 'App.svelte' });
```

## `svelte.preprocess`
## preprocess

> EXPORT_SNIPPET: svelte/compiler#preprocess

Expand Down Expand Up @@ -353,7 +353,7 @@ const { code } = await preprocess(source, [
});
```

## `svelte.walk`
## walk

> EXPORT_SNIPPET: svelte/compiler#walk

Expand Down Expand Up @@ -390,7 +390,7 @@ walk(ast, {
});
```

## `svelte.VERSION`
## VERSION

> EXPORT_SNIPPET: svelte/compiler#VERSION

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ The following initialisation options can be provided:

Existing children of `target` are left where they are.

The `hydrate` option instructs Svelte to upgrade existing DOM (usually from server-side rendering) rather than creating new elements. It will only work if the component was compiled with the [`hydratable: true` option](/docs/svelte-compiler#svelte-compile). Hydration of `<head>` elements only works properly if the server-side rendering code was also compiled with `hydratable: true`, which adds a marker to each element in the `<head>` so that the component knows which elements it's responsible for removing during hydration.
The `hydrate` option instructs Svelte to upgrade existing DOM (usually from server-side rendering) rather than creating new elements. It will only work if the component was compiled with the [`hydratable: true` option](/docs/svelte-compiler#compile). Hydration of `<head>` elements only works properly if the server-side rendering code was also compiled with `hydratable: true`, which adds a marker to each element in the `<head>` so that the component knows which elements it's responsible for removing during hydration.

Whereas children of `target` are normally left alone, `hydrate: true` will cause any children to be removed. For that reason, the `anchor` option cannot be used alongside `hydrate: true`.

Expand Down
2 changes: 1 addition & 1 deletion sites/svelte.dev/src/routes/docs/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
[/run-time-(svelte)(?:-(.+))?/i, '$1#$2'],

// Compile time
[/compile-time-?(.*)/i, 'svelte-compiler#$1'],
[/compile-time-svelte-?(.*)/i, 'svelte-compiler#$1'],

// Accessibility warnings
[/(accessibility-warnings)-?(.+)/i, '$1#$2']
Expand Down