chore(docs): update renderer docs (#2783)

This commit is contained in:
Stephen Hutchings 2023-04-22 17:17:35 +10:00 committed by GitHub
parent 7c1e114f9f
commit ed48aa1e72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -60,7 +60,7 @@ Marked provides methods for directly overriding the `renderer` and `tokenizer` f
<h2 id="renderer">The Renderer : <code>renderer</code></h2> <h2 id="renderer">The Renderer : <code>renderer</code></h2>
The renderer defines the HTML output of a given token. If you supply a `renderer` object to the Marked options, it will be merged with the built-in renderer and any functions inside will override the default handling of that token type. The renderer defines the HTML output of a given token. If you supply a `renderer` in the options object passed to `marked.use()`, any functions in the object will override the default handling of that token type.
Calling `marked.use()` to override the same function multiple times will give priority to the version that was assigned *last*. Overriding functions can return `false` to fall back to the previous override in the sequence, or resume default behavior if all overrides return `false`. Returning any other value (including nothing) will prevent fallback behavior. Calling `marked.use()` to override the same function multiple times will give priority to the version that was assigned *last*. Overriding functions can return `false` to fall back to the previous override in the sequence, or resume default behavior if all overrides return `false`. Returning any other value (including nothing) will prevent fallback behavior.