Skip to content

Commit

Permalink
docs: fixed missing language declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
arctic-hen7 committed Jan 12, 2023
1 parent 6bbd3cb commit 7b9d2df
Show file tree
Hide file tree
Showing 16 changed files with 23 additions and 23 deletions.
4 changes: 2 additions & 2 deletions docs/next/en-US/first-app/defining.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Once you've got all your dependencies installed, it's time to create the entrypo

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:

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

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

```
```rust
{{#include ../../../examples/core/basic/src/main.rs}}
```

Expand Down
2 changes: 1 addition & 1 deletion docs/next/en-US/first-app/deploying.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ But enough development shenanigans, we want to deploy this thing! To deploy a Pe

When you're ready, just run this command:

```
```sh
perseus deploy
```

Expand Down
2 changes: 1 addition & 1 deletion docs/next/en-US/first-app/dev-cycle.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ When you're developing a Perseus app, you'll generally have two "modes": coding,

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:

```
```toml
[build]
rustflags = [ "--cfg", "engine" ]
```
Expand Down
2 changes: 1 addition & 1 deletion docs/next/en-US/first-app/error-handling.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ In the same manner, Perseus doesn't want to produce bright red error messages in

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

```
```rust
{{#include ../../../examples/core/basic/src/error_views.rs}}
```

Expand Down
6 changes: 3 additions & 3 deletions docs/next/en-US/first-app/generating-pages.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Re-read that a couple of times, because it's the core idea that underlies Perseu

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:

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

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`:

```
```rust
{{#include ../../../examples/core/basic/src/templates/index.rs}}
```

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

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`:

```
```rust
{{#include ../../../examples/core/basic/src/templates/about.rs}}
```

Expand Down
6 changes: 3 additions & 3 deletions docs/next/en-US/first-app/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ Before you get to coding your first Perseus app, you'll need to install the Pers

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

```
```sh
cargo install perseus-cli --version 0.4.0-beta.14
```

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:

```
```sh
cargo new my-app
cd my-app
```

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:

```
```toml
[build]
rustflags = [ "--cfg", "engine" ]
```
Expand Down
2 changes: 1 addition & 1 deletion docs/next/en-US/fundamentals/hydration.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ As explained just now, Perseus *prerenders* your pages to HTML on the engine-sid

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

```
```html
<button onclick="console.log('Clicked!')">Click!</button>
```

Expand Down
6 changes: 3 additions & 3 deletions docs/next/en-US/fundamentals/i18n.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ But how do we know what language a user wants their pages in? Some sites figure

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

```
```rust
{{#include ../../../examples/core/i18n/src/main.rs}}
```

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

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:

```
```rust
{{#include ../../../examples/core/i18n/src/templates/index.rs}}
```

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

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:

```
```rust
Reactor::<G>::from_cx(cx).switch_locale("fr-FR")
```

Expand Down
2 changes: 1 addition & 1 deletion docs/next/en-US/fundamentals/js-interop.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ When you're working with Perseus, you usually won't need to use any JavaScript w

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

```
```rust
{{#include ../../../examples/core/js_interop/src/templates/index.rs}}
````

Expand Down
2 changes: 1 addition & 1 deletion docs/next/en-US/fundamentals/perseus-app.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Very often, there are a few things you want to apply throughout your app, like u

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

```
```rust
#{#include ../../../examples/core/index_view/src/main.rs}
```

Expand Down
2 changes: 1 addition & 1 deletion docs/next/en-US/fundamentals/preloading.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ There are two ways of using this interface: there's the easy way, and the fine-g

Here's an example of using preloading:

```
```rust
#{include ../../../examples/core/preload/src/templates/index.rs}
```

Expand Down
2 changes: 1 addition & 1 deletion docs/next/en-US/fundamentals/reactor.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The other thing the reactor does is manage all reactivity in Perseus. See, react

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

```
```rust
Reactor::<G>::from_cx(cx)
```

Expand Down
2 changes: 1 addition & 1 deletion docs/next/en-US/fundamentals/serving-exporting.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ When you run `perseus deploy -e`, Perseus will build your Wasm in release mode a

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:

```
```sh
perseus export-error-page --code 404 --output pkg/404.html
```

Expand Down
2 changes: 1 addition & 1 deletion docs/next/en-US/fundamentals/static-content.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ As nice as it is to write everything in Rust, you will, in web development, undo

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:

```
```rust
{{#include ../../../examples/core/static_content/src/main.rs}}
```

Expand Down
2 changes: 1 addition & 1 deletion docs/next/en-US/fundamentals/styling.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The comments in this file should make it fairly self-explanatory, but what it do

You can then use this like so:

```
```rust
{{#include ../../../examples/demos/full_page_layout/src/templates/index.rs}}
```

Expand Down
2 changes: 1 addition & 1 deletion docs/next/en-US/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ cargo install perseus-cli --version 0.4.0-beta.14

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:

```
```sh
perseus serve -w
```

Expand Down

0 comments on commit 7b9d2df

Please sign in to comment.