From c3cc6a2daffa4065650003890bdd4341f6c0507b Mon Sep 17 00:00:00 2001 From: Yutaka Omido Date: Wed, 13 Feb 2019 14:42:33 +0900 Subject: [PATCH] update document about extending renderer --- docs/USING_PRO.md | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/docs/USING_PRO.md b/docs/USING_PRO.md index 2a7517966b..e0889ad14f 100644 --- a/docs/USING_PRO.md +++ b/docs/USING_PRO.md @@ -45,18 +45,30 @@ console.log(myMarked('# heading+', { renderer: renderer })); ### Block level renderer methods -- code(*string* code, *string* language, *boolean* escaped) +- code(*string* code, *string* infostring, *boolean* escaped) - blockquote(*string* quote) - html(*string* html) -- heading(*string* text, *number* level, *string* rawtext) +- heading(*string* text, *number* level, *string* raw, *Slugger* slugger) - hr() - list(*string* body, *boolean* ordered, *number* start) - listitem(*string* text) +- checkbox(*boolean* checked) - paragraph(*string* text) - table(*string* header, *string* body) - tablerow(*string* content) - tablecell(*string* content, *object* flags) +`slugger` has the `slug` method to create an unique id from value: + +```js +slugger.slug('foo') // foo +slugger.slug('foo') // foo-1 +slugger.slug('foo') // foo-2 +slugger.slug('foo 1') // foo-1-1 +slugger.slug('foo-1') // foo-1-2 +... +``` + `flags` has the following properties: ```js