doc: Fix links and Rust highlightning

master
Jesper Håkansson 6 years ago
parent c8410f2de7
commit 6fc3f9b349
  1. 4
      docs/src/prerequisites/index.md
  2. 4
      docs/src/tutorial/index.md
  3. 10
      docs/src/tutorial/template-deep-dive/src-utils-rs.md

@ -2,8 +2,8 @@
To run `wasm-pack` you'll need to have both Rust and npm installed and configured.
- [Rust](./rust.html)
- [npm](./npm.html)
- [Rust](./prerequisites/rust.html)
- [npm](./prerequisites/npm.html)
In the future, we intend to rewrite the npm registry client bits so that the need
for a Node runtime is eliminated. If you're excited about that work- you should

@ -10,8 +10,8 @@ Be sure to have done the following before starting:
1. [Install `wasm-pack`](../../installer)
1. Read and install the [Prerequisites](../prerequisites/index.html).
- You'll need [Rust], version 1.30 or higher. (Currently either `beta` or `nightly` channels). [Learn more](../project-setup/rust.html).
- You'll need [Node.js] and [npm] installed. You'll also need an npm Account. [Learn more](../project-setup/npm.html).
- You'll need [Rust], version 1.30 or higher. (Currently either `beta` or `nightly` channels). [Learn more](../prerequisites/rust.html).
- You'll need [Node.js] and [npm] installed. You'll also need an npm Account. [Learn more](../prerequisites/npm.html).
We strongly recommend that you install [Node.js] using a version manager. You can learn more [here](https://npmjs.com/get-npm).

@ -13,13 +13,13 @@ We will discuss:
## 1. Defining `set_panic_hook`
```
```rust
use cfg_if::cfg_if;
```
This allows us to write `cfg_if!` instead of `cfg_if::cfg_if!`, identically to the line in `src/lib.rs`.
```
```rust
cfg_if! {
if #[cfg(feature = "console_error_panic_hook")] {
extern crate console_error_panic_hook;
@ -35,14 +35,14 @@ As described in the preceding section, the macro `cfg_if!` evaluates the `if` st
The entire macro block will either be replaced with the statements in the `if` block or with those in the `else` block. These two cases are now described in turn:
```
```rust
extern crate console_error_panic_hook;
pub use self::console_error_panic_hook::set_once as set_panic_hook;
```
Due to the `use` statement, the function `self::console_error_panic_hook::set_once` can now be accessed more conveniently as `set_panic_hook`. Due to `pub`, this function will be publicly accessible outside of the `utils` module as `utils::set_panic_hook`.
```
```rust
#[inline]
pub fn set_panic_hook() {}
```
@ -63,4 +63,4 @@ To do this, a panic hook for WebAssembly is provided that logs panics to the dev
Note that although the template sets up the function, your error messages will not automatically be enhanced. To enable the enhanced errors, call the function `utils::set_panic_hook()` in `lib.rs` when your code first runs. The function may be called multiple times if needed.
For more details, see the [`console_error_panic_hook` repository](https://github.com/rustwasm/console_error_panic_hook).
For more details, see the [`console_error_panic_hook` repository](https://github.com/rustwasm/console_error_panic_hook).

Loading…
Cancel
Save