From fda66024f1735f67015c85e660b84bb7f9344bd7 Mon Sep 17 00:00:00 2001 From: Mark Date: Sun, 13 Dec 2020 20:52:36 -0500 Subject: [PATCH 01/15] build(package): upgrade devDependencies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @typescript-eslint/parser ^4.9.0 → ^4.9.1 eslint-plugin-prettier ^3.2.0 → ^3.3.0 husky ^4.3.5 → ^4.3.6 standard-version 5 → ^9.0.0 typescript ^4.1.2 → ^4.1.3 --- package.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index a39aeb97..a180b728 100644 --- a/package.json +++ b/package.json @@ -42,12 +42,12 @@ "@rollup/plugin-commonjs": "^17.0.0", "@rollup/plugin-node-resolve": "^11.0.0", "@types/react": "^17.0.0", - "@typescript-eslint/parser": "^4.9.0", + "@typescript-eslint/parser": "^4.9.1", "benchmark": "^2.1.4", "dtslint": "^4.0.6", "eslint": "^7.15.0", - "eslint-plugin-prettier": "^3.2.0", - "husky": "^4.3.5", + "eslint-plugin-prettier": "^3.3.0", + "husky": "^4.3.6", "jest": "^26.6.3", "lint-staged": "^10.5.3", "preact": "^10.5.7", @@ -57,8 +57,8 @@ "rimraf": "^3.0.2", "rollup": "^2.34.2", "rollup-plugin-terser": "^7.0.2", - "standard-version": "5", - "typescript": "^4.1.2" + "standard-version": "^9.0.0", + "typescript": "^4.1.3" }, "peerDependencies": { "react": "^0.14 || ^15 || ^16 || ^17" From f67cc8d45069e13df6fe5f997a362a36100fff0b Mon Sep 17 00:00:00 2001 From: Mark Date: Sun, 13 Dec 2020 22:14:01 -0500 Subject: [PATCH 02/15] docs(readme): fix and update README.md --- README.md | 114 +++++++++++++++++++++++++++++++++--------------------- 1 file changed, 69 insertions(+), 45 deletions(-) diff --git a/README.md b/README.md index 1253e099..7b311ced 100644 --- a/README.md +++ b/README.md @@ -15,15 +15,17 @@ HTML to React parser that works on both the server (Node.js) and the client (bro HTMLReactParser(string[, options]) ``` -It converts an HTML string to one or more [React elements](https://reactjs.org/docs/react-api.html#creating-react-elements). There's also an option to [replace an element](#replacedomnode) with your own. - -Example: +The parser converts an HTML string to one or more [React elements](https://reactjs.org/docs/react-api.html#creating-react-elements): ```js const parse = require('html-react-parser'); parse('
text
'); // equivalent to `React.createElement('div', {}, 'text')` ``` +To replace an element with a custom element, check out the [replace option](#replacedomnode). + +Demos: + [CodeSandbox](https://codesandbox.io/s/940pov1l4w) | [Repl.it](https://repl.it/@remarkablemark/html-react-parser) | [JSFiddle](https://jsfiddle.net/remarkablemark/7v86d800/) | [Examples](https://github.com/remarkablemark/html-react-parser/tree/master/examples)
@@ -75,7 +77,7 @@ $ yarn add html-react-parser ```html - +