diff --git a/docs/USING_PRO.md b/docs/USING_PRO.md index 06668110..bd16f1a3 100644 --- a/docs/USING_PRO.md +++ b/docs/USING_PRO.md @@ -53,7 +53,7 @@ Before building your custom extensions, it is important to understand the compon 4) The `parser` traverses the token tree and feeds each token into the appropriate `renderer`, and concatenates their outputs into the final HTML result. 5) Each `renderer` receives a token and manipulates its contents to generate a segment of HTML. -Marked provides methods for directly overriding the `renderer` and `tokenizer` for any existing token type, as well as inserting additional custom `renderer` and `tokenizer` functions to handle entirely custom syntax. +Marked provides methods for directly overriding the `renderer` and `tokenizer` for any existing token type, as well as inserting additional custom `renderer` and `tokenizer` functions to handle entirely custom syntax. For example, using `marked.use({renderer})` would modify a render, whereas `marked.use({extenstions: [{renderer}]})` would add a new renderer. See the [custom extensions example](#custom-extensions-example) for insight on how to execute this. *** @@ -100,6 +100,18 @@ console.log(marked.parse('# heading+')); heading+ ``` +**Note:** Calling `marked.use()` in the following way will avoid overriding the `heading` token output but create a new renderer in the process. + +```js +marked.use({ + extensions: [{ + name: 'heading', + renderer(token) { + return /* ... */ + } + }] +}) +``` ### Block-level renderer methods @@ -441,7 +453,7 @@ The renderer function has access to the parser in the `this` object, which can b
An array of strings that match the names of any token parameters that should be traversed by the walkTokens functions. For instance, if you want to use a second custom parameter to contain child tokens in addition to tokens, it could be listed here. If childTokens is provided, the tokens array will not be walked by default unless it is also included in the childTokens array.
-**Example:** Add a custom syntax to generate `
` description lists. +**Example:** Add a custom syntax to generate `
` description lists. ``` js const descriptionList = {