From 3ad404039fb5ad16a3b700433d97bef43fc2bc7b Mon Sep 17 00:00:00 2001 From: Oscar Date: Wed, 7 Oct 2020 02:29:09 +0200 Subject: [PATCH] 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 --- docs/route.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/route.md b/docs/route.md index 2c395e69..2bb23701 100644 --- a/docs/route.md +++ b/docs/route.md @@ -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` | Yes | An object whose keys are route strings and values are either components or a [RouteResolver](#routeresolver) +`routes` | Object<String,Component|RouteResolver> | 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` | 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.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|String|Number|Boolean` | No | Child [vnodes](vnodes.md) for this link. +`children` | Array<Vnode>|String|Number|Boolean | 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** | 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 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|undefined` | Returns a component or a promise that resolves to a component +**returns** | Component|Promise<Component>|undefined | 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` | The [vnodes](vnodes.md) to be rendered +**returns** | Array<Vnode>|Vnode | 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"), ...})]`.