Merge pull request #514 from drager/docs-fixes

doc: Fix links and Rust highlightning
master
ashley williams 6 years ago committed by GitHub
commit dbc5a3655d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      docs/src/prerequisites/index.md
  2. 4
      docs/src/tutorial/index.md
  3. 8
      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. To run `wasm-pack` you'll need to have both Rust and npm installed and configured.
- [Rust](./rust.html) - [Rust](./prerequisites/rust.html)
- [npm](./npm.html) - [npm](./prerequisites/npm.html)
In the future, we intend to rewrite the npm registry client bits so that the need 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 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. [Install `wasm-pack`](../../installer)
1. Read and install the [Prerequisites](../prerequisites/index.html). 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 [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](../project-setup/npm.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). 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` ## 1. Defining `set_panic_hook`
``` ```rust
use cfg_if::cfg_if; 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`. This allows us to write `cfg_if!` instead of `cfg_if::cfg_if!`, identically to the line in `src/lib.rs`.
``` ```rust
cfg_if! { cfg_if! {
if #[cfg(feature = "console_error_panic_hook")] { if #[cfg(feature = "console_error_panic_hook")] {
extern crate 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: 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; extern crate console_error_panic_hook;
pub use self::console_error_panic_hook::set_once as set_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`. 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] #[inline]
pub fn set_panic_hook() {} pub fn set_panic_hook() {}
``` ```

Loading…
Cancel
Save