From f15d851ee83c140eead9dd5590d296f76f205459 Mon Sep 17 00:00:00 2001 From: pavittarx Date: Sat, 23 May 2020 12:22:27 +0530 Subject: [PATCH] Docs update --- README.md | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index a04248a..24841ed 100644 --- a/README.md +++ b/README.md @@ -17,18 +17,18 @@ A utility to parse editorjs clean data to HTML. npm install editorjs-html ### CDN -* https://cdn.jsdelivr.net/npm/editorjs-html@1.1.0/build/edjsHTML.js -* (Browser Only Build): https://cdn.jsdelivr.net/npm/editorjs-html@1.1.0/build/edjsHTML.browser.js +* https://cdn.jsdelivr.net/npm/editorjs-html@2.0.0/build/edjsHTML.js +* (Browser Only Build): https://cdn.jsdelivr.net/npm/editorjs-html@2.0.0/build/edjsHTML.browser.js ## Usage ### Browser ```js - const edjsParser = edjsHTML(); + const edjsParser = edjsHTML(); - let html = edjsParser.parse(editorjs_clean_data); + let html = edjsParser.parse(editorjs_clean_data); - console.log(html); + console.log(html); ``` ### Nodejs @@ -41,20 +41,25 @@ npm install editorjs-html console.log(html); ``` +## Updates + +See [Releases](https://github.com/pavittarx/editorjs-html/releases) + ### Supported Block Types * Header (H1-H6) * Lists (Ordered & Unordered) * Images * Delimiter +* Paragraph ## Parse Single Clean Data Blocks ```js - const edjsParser = edjsHTML(); - const blockHTML = edjsParser.parseBlock(editorjs_clean_data_block); + const edjsParser = edjsHTML(); + const blockHTML = edjsParser.parseBlock(editorjs_clean_data_block); - console.log(blockHTML); + console.log(blockHTML); ``` ### Extend For Custom Blocks @@ -65,23 +70,23 @@ npm install editorjs-html * The name of the function must match with editor-js custom block type. ```js - // Your custom editorjs generated block + // Your custom editorjs generated block { - type: "custom", - data: { - text: "Hello World" - } + type: "custom", + data: { + text: "Hello World" + } } ``` ```js - // Parse this block in editorjs-html - function customParser(data){ - return ` ${data.text} `; - } + // Parse this block in editorjs-html + function customParser(block){ + return ` ${block.data.text} `; + } - const edjsParser = edjsHTML({custom: customParser}); + const edjsParser = edjsHTML({custom: customParser}); ```