fix some typos (#2487)

* fix some typos

Found some typos. Mainly unescaped `|` in tables, but also a few other irregularities. Not all problems are visible in the website docs.

* fix `<>` and `|` rendering

Fix those symbols inside a Markdown table, so they render correctly on the website and Github.

Co-authored-by: Isiah Meadows <contact@isiahmeadows.com>
This commit is contained in:
Oscar 2020-10-07 02:29:09 +02:00 committed by GitHub
parent 9f0dc2ab46
commit 3ad404039f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -59,7 +59,7 @@ Argument | Type | Required | D
---------------------- | ---------------------------------------- | -------- | ---
`root` | `Element` | Yes | A DOM element that will be the parent node to the subtree
`defaultRoute` | `String` | Yes | The route to redirect to if the current URL does not match a route
`routes` | `Object<String,Component|RouteResolver>` | Yes | An object whose keys are route strings and values are either components or a [RouteResolver](#routeresolver)
`routes` | <code>Object&#x3c;String,Component&vert;RouteResolver&#x3e;</code> | Yes | An object whose keys are route strings and values are either components or a [RouteResolver](#routeresolver)
**returns** | | | Returns `undefined`
[How to read signatures](signatures.md)
@ -104,7 +104,7 @@ Returns the last fully resolved routing path, without the prefix. It may differ
Argument | Type | Required | Description
----------------- | --------- | -------- | ---
**returns** | String | | Returns the last fully resolved path
**returns** | `String` | | Returns the last fully resolved path
##### m.route.prefix
@ -166,7 +166,7 @@ m("span", {
})
```
You can also prevent navigation by, in an `onclick` handler, invoking `ev.preventDefault()` or returning `false`. This is the same way you block other events, so it's pretty natural.
You can also prevent navigation by, in an `onclick` handler, invoking `e.preventDefault()` or returning `false`. This is the same way you block other events, so it's pretty natural.
```javascript
m(m.route.Link, {
@ -202,12 +202,12 @@ Do note that this doesn't also disable pointer events for you - you have to do t
Argument | Type | Required | Description
--------------------- | ------------------------------------ | -------- | ---
`attributes.href` | `Object` | Yes | The target route to navigate to.
`attributes.selector` | `String|Object|Function` | No | This sets the tag name to use. Must be a valid selector for [`m`](hyperscript.md) if given, defaults to `"a"`.
`attributes.selector` | <code>String&vert;Object&vert;Function</code> | No | This sets the tag name to use. Must be a valid selector for [`m`](hyperscript.md) if given, defaults to `"a"`.
`attributes.options` | `Object` | No | This sets the options passed to [`m.route.set`](#mrouteset).
`attributes.params` | `Object` | No | This sets the parameters passed to [`m.route.set`](#mrouteset).
`attributes.disabled` | `Object` | No | This sets the options passed to [`m.route.set`](#mrouteset).
`attributes.disabled` | `Object` | No | This disables the link, so clicking on it doesn't route anywhere.
`attributes` | `Object` | No | Other attributes to apply to the returned vnode may be passed.
`children` | `Array<Vnode>|String|Number|Boolean` | No | Child [vnodes](vnodes.md) for this link.
`children` | <code>Array&#x3c;Vnode&#x3e;&vert;String&vert;Number&vert;Boolean</code> | No | Child [vnodes](vnodes.md) for this link.
**returns** | `Vnode` | | A [vnode](vnodes.md).
##### m.route.param
@ -223,7 +223,7 @@ Retrieves a route parameter from the last fully resolved route. A route paramete
Argument | Type | Required | Description
----------------- | --------------- | -------- | ---
`key` | `String` | No | A route parameter name (e.g. `id` in route `/users/:id`, or `page` in path `/users/1?page=3`, or a key in `history.state`)
**returns** | `String|Object` | | Returns a value for the specified key. If a key is not specified, it returns an object that contains all the interpolation keys
**returns** | <code>String&vert;Object</code> | | Returns a value for the specified key. If a key is not specified, it returns an object that contains all the interpolation keys
Note that in the `onmatch` function of a RouteResolver, the new route hasn't yet been fully resolved, and `m.route.param()` will return the parameters of the previous route, if any. `onmatch` receives the parameters of the new route as an argument.
@ -265,7 +265,7 @@ Argument | Type | Description
`args` | `Object` | The [routing parameters](#routing-parameters)
`requestedPath` | `String` | The router path requested by the last routing action, including interpolated routing parameter values, but without the prefix. When `onmatch` is called, the resolution for this path is not complete and `m.route.get()` still returns the previous path.
`route` | `String` | The router path requested by the last routing action, excluding interpolated routing parameter values
**returns** | `Component|Promise<Component>|undefined` | Returns a component or a promise that resolves to a component
**returns** | <code>Component&vert;Promise&#x3c;Component&#x3e;&vert;undefined</code> | Returns a component or a promise that resolves to a component
If `onmatch` returns a component or a promise that resolves to a component, this component is used as the `vnode.tag` for the first argument in the RouteResolver's `render` method. Otherwise, `vnode.tag` is set to `"div"`. Similarly, if the `onmatch` method is omitted, `vnode.tag` is also `"div"`.
@ -275,13 +275,13 @@ If `onmatch` returns a promise that gets rejected, the router redirects back to
The `render` method is called on every redraw for a matching route. It is similar to the `view` method in components and it exists to simplify [component composition](#wrapping-a-layout-component). It also lets you escape from Mithril's normal behavior of replacing the entire subtree.
`vnode = routeResolve.render(vnode)`
`vnode = routeResolver.render(vnode)`
Argument | Type | Description
------------------- | -------------------- | -----------
`vnode` | `Object` | A [vnode](vnodes.md) whose attributes object contains routing parameters. If onmatch does not return a component or a promise that resolves to a component, the vnode's `tag` field defaults to `"div"`
`vnode.attrs` | `Object` | A map of URL parameter values
**returns** | `Array<Vnode>|Vnode` | The [vnodes](vnodes.md) to be rendered
**returns** | <code>Array&#x3c;Vnode&#x3e;&vert;Vnode</code> | The [vnodes](vnodes.md) to be rendered
The `vnode` parameter is just `m(Component, m.route.param())` where `Component` is the resolved component for the route (after `routeResolver.onmatch`) and `m.route.param()` is as documented [here](#mrouteparam). If you omit this method, the default return value is `[vnode]`, wrapped in a fragment so you can use [key parameters](#key-parameter). Combined with a `:key` parameter, it becomes a [single-element keyed fragment](keys.md#reinitializing-views-with-single-child-keyed-fragments), since it ends up rendering to something like `[m(Component, {key: m.route.param("key"), ...})]`.