Skip to content

Commit 7b9d2df

Browse files
committed
docs: fixed missing language declarations
1 parent 6bbd3cb commit 7b9d2df

16 files changed

+23
-23
lines changed

docs/next/en-US/first-app/defining.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Once you've got all your dependencies installed, it's time to create the entrypo
44

55
Remember, you can tell Rust to only compile some code on the engine-side by putting `#[cfg(engine)]` over it, and you can use `#[cfg(client)]` to do the same for the browser. So, our code in `main.rs` should logically look something like this:
66

7-
```
7+
```rust
88
#[cfg(engine)]
99
fn main() {
1010
// Engine code here
@@ -26,7 +26,7 @@ So what is this `PerseusApp`, you might ask? This `struct` forms the bridge betw
2626

2727
So, our actual `src/main.rs` file would look something like this (theory over, *now* we start coding):
2828

29-
```
29+
```rust
3030
{{#include ../../../examples/core/basic/src/main.rs}}
3131
```
3232

docs/next/en-US/first-app/deploying.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ But enough development shenanigans, we want to deploy this thing! To deploy a Pe
2020

2121
When you're ready, just run this command:
2222

23-
```
23+
```sh
2424
perseus deploy
2525
```
2626

docs/next/en-US/first-app/dev-cycle.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ When you're developing a Perseus app, you'll generally have two "modes": coding,
44

55
When you're using an IDE, like VS Code, you'll usually want proper syntax highlighting, and you may find that Perseus causea few problems. This is because Perseus distinguishes between the engine and the browser by using a custom feature, so you'll need to create a `.cargo/config.toml` file in the root of your project with the following contents:
66

7-
```
7+
```toml
88
[build]
99
rustflags = [ "--cfg", "engine" ]
1010
```

docs/next/en-US/first-app/error-handling.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ In the same manner, Perseus doesn't want to produce bright red error messages in
66

77
First, put the following in `src/error_views.rs`:
88

9-
```
9+
```rust
1010
{{#include ../../../examples/core/basic/src/error_views.rs}}
1111
```
1212

docs/next/en-US/first-app/generating-pages.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Re-read that a couple of times, because it's the core idea that underlies Perseu
88

99
A template is like a page with some holes. A `post` template might have all the styling, the header, the footer, etc., with a gap for the title, a gap for the content, maybe a gap for some tags, etc. Think of them like stencils. You can then generate *state*, which is a term Perseus uses for data that can fill in a template. Generally speaking, if you list the gaps in your template, and make a `struct` with a field for each of those gaps, that's what your state should look like. So, if we were making a blog, we would have a struct that perhaps looks something like this:
1010

11-
```
11+
```rust
1212
struct PostState {
1313
title: String,
1414
content: String,
@@ -24,7 +24,7 @@ But for this tutorial, we're just getting started, so we'll use *build-time stat
2424

2525
To do this, first add `pub mod index;` to your `src/templates/mod.rs` file, and then out the following in `src/templates/index.rs`:
2626

27-
```
27+
```rust
2828
{{#include ../../../examples/core/basic/src/templates/index.rs}}
2929
```
3030

@@ -60,7 +60,7 @@ This is called the *functional definition* pattern in Perseus: you define your `
6060

6161
With all that out of the way, let's create an even simpler page to demonstrate Perseus routing, an about page. Add `pub mod about;` to `src/templates/mod.rs`, and then put this into `src/templates/about.rs`:
6262

63-
```
63+
```rust
6464
{{#include ../../../examples/core/basic/src/templates/about.rs}}
6565
```
6666

docs/next/en-US/first-app/installation.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@ Before you get to coding your first Perseus app, you'll need to install the Pers
44

55
To install the Perseus CLI, first make sure you have Rust installed (preferably with [`rustup`]), and then run this command:
66

7-
```
7+
```sh
88
cargo install perseus-cli --version 0.4.0-beta.14
99
```
1010

1111
Once that's done, you can go ahead and create your first app! Although this would usually be done with the `perseus new` command, which spins up a scaffold for you, in this tutorial we'll do things manually so we can go through each line of code step by step. First, create a new Rust project:
1212

13-
```
13+
```sh
1414
cargo new my-app
1515
cd my-app
1616
```
1717

1818
This will create a new directory called `my-app/` that's equipped for a binary project (i.e. something you can run, rather than a library, which other code uses). First of all, create `.cargo/config.toml` in the root of your project, with the following contents:
1919

20-
```
20+
```toml
2121
[build]
2222
rustflags = [ "--cfg", "engine" ]
2323
```

docs/next/en-US/fundamentals/hydration.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ As explained just now, Perseus *prerenders* your pages to HTML on the engine-sid
2626

2727
Okay, if you're used to using vanilla JavaScript, you might be recalling how you could write something like this:
2828

29-
```
29+
```html
3030
<button onclick="console.log('Clicked!')">Click!</button>
3131
```
3232

docs/next/en-US/fundamentals/i18n.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ But how do we know what language a user wants their pages in? Some sites figure
88

99
You can set up internationalization in your app through `PerseusApp` like so:
1010

11-
```
11+
```rust
1212
{{#include ../../../examples/core/i18n/src/main.rs}}
1313
```
1414

@@ -20,7 +20,7 @@ In Perseus, translators are controlled by feature flags, which are mutually excl
2020

2121
Take a look at [this example] for how a full i18n-ed app looks (or you can take a look at the source code of this website!). Once you've defined some translations IDs, you can use them like so:
2222

23-
```
23+
```rust
2424
{{#include ../../../examples/core/i18n/src/templates/index.rs}}
2525
```
2626

@@ -36,7 +36,7 @@ Switching locales is actually incredibly easy: there's no context to update, or
3636

3737
If you're using a component to perform locale switching (often included in the header or footer), you'll want to check what path a user is currently on so you switch the locale for the current page. This is typically done through a `Reactor` convenience method:
3838

39-
```
39+
```rust
4040
Reactor::<G>::from_cx(cx).switch_locale("fr-FR")
4141
```
4242

docs/next/en-US/fundamentals/js-interop.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ When you're working with Perseus, you usually won't need to use any JavaScript w
44

55
A simple example of working with JS might be this, on the landing page of a hypothetical app:
66

7-
```
7+
```rust
88
{{#include ../../../examples/core/js_interop/src/templates/index.rs}}
99
````
1010

docs/next/en-US/fundamentals/perseus-app.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Very often, there are a few things you want to apply throughout your app, like u
2020

2121
Here's an example of an app definition using an index view:
2222

23-
```
23+
```rust
2424
#{#include ../../../examples/core/index_view/src/main.rs}
2525
```
2626

docs/next/en-US/fundamentals/preloading.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ There are two ways of using this interface: there's the easy way, and the fine-g
88

99
Here's an example of using preloading:
1010

11-
```
11+
```rust
1212
#{include ../../../examples/core/preload/src/templates/index.rs}
1313
```
1414

docs/next/en-US/fundamentals/reactor.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The other thing the reactor does is manage all reactivity in Perseus. See, react
66

77
Accessing the reactor is very simple, as it's provided through Sycamore's context system, and it has a method for extracting itself therefrom:
88

9-
```
9+
```rust
1010
Reactor::<G>::from_cx(cx)
1111
```
1212

docs/next/en-US/fundamentals/serving-exporting.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ When you run `perseus deploy -e`, Perseus will build your Wasm in release mode a
5252

5353
One thing exported apps often struggle with is proper error handling. Once the Wasm bundle has been delivered to the client, they're fine and dandy, and can display all the errors they like, but the server-side is trickier. When Perseus controls it, it can carefully format error pages with exactly the right information, but typical file servers aren't quite so subtle. Especially for internationalized apps, this can be a problem. The best solution is to export your error pages to static files, which can be done like so:
5454

55-
```
55+
```sh
5656
perseus export-error-page --code 404 --output pkg/404.html
5757
```
5858

docs/next/en-US/fundamentals/static-content.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ As nice as it is to write everything in Rust, you will, in web development, undo
44

55
Sometimes, however, you'll want static content from outside `static/`, which is where *static aliases* come into play. These allow you to link in arbitrary files hosted at arbitrary paths, which will be served unquestioningly by Perseus. You can declare static aliases on your `PerseusApp` like so:
66

7-
```
7+
```rust
88
{{#include ../../../examples/core/static_content/src/main.rs}}
99
```
1010

docs/next/en-US/fundamentals/styling.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ The comments in this file should make it fairly self-explanatory, but what it do
2222

2323
You can then use this like so:
2424

25-
```
25+
```rust
2626
{{#include ../../../examples/demos/full_page_layout/src/templates/index.rs}}
2727
```
2828

docs/next/en-US/quickstart.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ cargo install perseus-cli --version 0.4.0-beta.14
1212

1313
Now, pop over to some directory where you keep your projects, and run `perseus new my-app`. That will create a new directory called `my-app/`, which you can easily `cd` into, and, once you're there, you can run this command to start your app:
1414

15-
```
15+
```sh
1616
perseus serve -w
1717
```
1818

0 commit comments

Comments
 (0)