Repository: remarkablemark/html-react-parser
Pull request #1623 (2024-12-04 04:25:22)

build(deps): bump html-dom-parser from 5.0.10 to 5.0.11
Bumps [html-dom-parser](https://github.com/remarkablemark/html-dom-parser) from 5.0.10 to 5.0.11.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/remarkablemark/html-dom-parser/releases">html-dom-parser's releases</a>.</em></p>
<blockquote>
<h2>v5.0.11</h2>
<h2><a href="https://github.com/remarkablemark/html-dom-parser/compare/v5.0.10...v5.0.11">5.0.11</a> (2024-12-04)</h2>
<h3>Bug Fixes</h3>
<ul>
<li>enable client parser to retain carriage return characters (<a href="https://redirect.github.com/remarkablemark/html-dom-parser/issues/902">#902</a>) (<a href="https://github.com/remarkablemark/html-dom-parser/commit/fe2e993d69c45e44696224985e558efca79db181">fe2e993</a>), closes <a href="https://redirect.github.com/remarkablemark/html-dom-parser/issues/420">#420</a> <a href="https://github.com/kingflamez"><code>@​kingflamez</code></a></li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/remarkablemark/html-dom-parser/blob/master/CHANGELOG.md">html-dom-parser's changelog</a>.</em></p>
<blockquote>
<h2><a href="https://github.com/remarkablemark/html-dom-parser/compare/v5.0.10...v5.0.11">5.0.11</a> (2024-12-04)</h2>
<h3>Bug Fixes</h3>
<ul>
<li>enable client parser to retain carriage return characters (<a href="https://redirect.github.com/remarkablemark/html-dom-parser/issues/902">#902</a>) (<a href="https://github.com/remarkablemark/html-dom-parser/commit/fe2e993d69c45e44696224985e558efca79db181">fe2e993</a>), closes <a href="https://redirect.github.com/remarkablemark/html-dom-parser/issues/420">#420</a></li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/remarkablemark/html-dom-parser/commit/92738658fa61a1475bb2314ffbf02ae47cf3adda"><code>9273865</code></a> Merge pull request <a href="https://redirect.github.com/remarkablemark/html-dom-parser/issues/910">#910</a> from remarkablemark/release-please--branches--master-...</li>
<li><a href="https://github.com/remarkablemark/html-dom-parser/commit/23fedd12d2f546dbadcebca44ce66a913d561bec"><code>23fedd1</code></a> chore(master): release 5.0.11</li>
<li><a href="https://github.com/remarkablemark/html-dom-parser/commit/ddc193c21f4598f37e28810ed6157af9aa2b885b"><code>ddc193c</code></a> build(package): bump <code>@​rollup/plugin-typescript</code> from 11.1.6 to 12.1.1</li>
<li><a href="https://github.com/remarkablemark/html-dom-parser/commit/fe2e993d69c45e44696224985e558efca79db181"><code>fe2e993</code></a> fix: enable client parser to retain carriage return characters (<a href="https://redirect.github.com/remarkablemark/html-dom-parser/issues/902">#902</a>)</li>
<li><a href="https://github.com/remarkablemark/html-dom-parser/commit/c4fc01e988236746e2459470692d70a333c6eade"><code>c4fc01e</code></a> build(deps-dev): bump mocha from 10.8.2 to 11.0.1 (<a href="https://redirect.github.com/remarkablemark/html-dom-parser/issues/908">#908</a>)</li>
<li><a href="https://github.com/remarkablemark/html-dom-parser/commit/c9833f2915e3b3a02d280630c845e6f56f6a712f"><code>c9833f2</code></a> build(deps-dev): bump the typescript-eslint group with 2 updates (<a href="https://redirect.github.com/remarkablemark/html-dom-parser/issues/907">#907</a>)</li>
<li><a href="https://github.com/remarkablemark/html-dom-parser/commit/0a902f4c1b8fcfb1f88f88871a2da5b2e3fda511"><code>0a902f4</code></a> build(deps-dev): bump rollup from 4.27.4 to 4.28.0 (<a href="https://redirect.github.com/remarkablemark/html-dom-parser/issues/904">#904</a>)</li>
<li><a href="https://github.com/remarkablemark/html-dom-parser/commit/2d600134c02c82ddfe091942cfe0dbb4c6e5427f"><code>2d60013</code></a> build(deps-dev): bump globals from 15.12.0 to 15.13.0 (<a href="https://redirect.github.com/remarkablemark/html-dom-parser/issues/906">#906</a>)</li>
<li><a href="https://github.com/remarkablemark/html-dom-parser/commit/872c0905b1066d56aa0495c43c68c2f65480259a"><code>872c090</code></a> build(deps-dev): bump eslint from 9.15.0 to 9.16.0 (<a href="https://redirect.github.com/remarkablemark/html-dom-parser/issues/905">#905</a>)</li>
<li><a href="https://github.com/remarkablemark/html-dom-parser/commit/d532230ce753731a949e6cf11d39a24c06bc9f92"><code>d532230</code></a> build(deps-dev): bump <code>@​eslint/js</code> in the eslint group (<a href="https://redirect.github.com/remarkablemark/html-dom-parser/issues/903">#903</a>)</li>
<li>Additional commits viewable in <a href="https://github.com/remarkablemark/html-dom-parser/compare/v5.0.10...v5.0.11">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=html-dom-parser&package-manager=npm_and_yarn&previous-version=5.0.10&new-version=5.0.11)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>

codecov[bot]: ## [Codecov](https://app.codecov.io/gh/remarkablemark/html-react-parser/pull/1623?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Mark) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Project coverage is 100.00%. Comparing base [(`86d571d`)](https://app.codecov.io/gh/remarkablemark/html-react-parser/commit/86d571dab1ffe8e4ed56e4b70fe5c14ed9db84e3?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Mark) to head [(`35b6e04`)](https://app.codecov.io/gh/remarkablemark/html-react-parser/commit/35b6e04108ade60adf4702031096ceec5bb2a540?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Mark).

<details><summary>Additional details and impacted files</summary>


```diff
@@            Coverage Diff            @@
##            master     #1623   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            8         8           
  Lines          151       151           
  Branches        49        49           
=========================================
  Hits           151       151           
```

</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/remarkablemark/html-react-parser/pull/1623?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Mark).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Mark).

github-actions[bot]: ## size-limit report 📦 
| Path                          | Size                | Loading time (3g)  | Running time (snapdragon) | Total time |
| ----------------------------- | ------------------- | ------------------ | ------------------------- | ---------- |
| dist/html-react-parser.min.js | 9.45 KB (+0.79% 🔺) | 189 ms (+0.79% 🔺) | 80 ms (+29.84% 🔺)        | 269 ms     |

Patch:
diff --git a/package-lock.json b/package-lock.json
index e52633d..61e5ae9 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -10,7 +10,7 @@
       "license": "MIT",
       "dependencies": {
         "domhandler": "5.0.3",
-        "html-dom-parser": "5.0.10",
+        "html-dom-parser": "5.0.11",
         "react-property": "2.0.2",
         "style-to-js": "1.1.16"
       },
@@ -5521,10 +5521,9 @@
       }
     },
     "node_modules/html-dom-parser": {
-      "version": "5.0.10",
-      "resolved": "https://registry.npmjs.org/html-dom-parser/-/html-dom-parser-5.0.10.tgz",
-      "integrity": "sha512-GwArYL3V3V8yU/mLKoFF7HlLBv80BZ2Ey1BzfVNRpAci0cEKhFHI/Qh8o8oyt3qlAMLlK250wsxLdYX4viedvg==",
-      "license": "MIT",
+      "version": "5.0.11",
+      "resolved": "https://registry.npmjs.org/html-dom-parser/-/html-dom-parser-5.0.11.tgz",
+      "integrity": "sha512-iORudm2K0c0DYeEj4AbrG9PFzgp1dpFGkJUAiBlVTkeyaNf2YYIs1b0dF7rQUPnDZimkLx+Jls+CvRIKO/++Tg==",
       "dependencies": {
         "domhandler": "5.0.3",
         "htmlparser2": "9.1.0"
diff --git a/package.json b/package.json
index 20163f9..5c10719 100644
--- a/package.json
+++ b/package.json
@@ -49,7 +49,7 @@
   ],
   "dependencies": {
     "domhandler": "5.0.3",
-    "html-dom-parser": "5.0.10",
+    "html-dom-parser": "5.0.11",
     "react-property": "2.0.2",
     "style-to-js": "1.1.16"
   },


Test patch:
diff --git a/__tests__/__snapshots__/index.test.tsx.snap b/__tests__/__snapshots__/index.test.tsx.snap
new file mode 100644
index 0000000..07a86f4
--- /dev/null
+++ b/__tests__/__snapshots__/index.test.tsx.snap
@@ -0,0 +1,57 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`HTMLReactParser parses HTML with newlines 1`] = `
+[
+  "
+",
+  <br />,
+]
+`;
+
+exports[`HTMLReactParser parses HTML with newlines 2`] = `
+[
+  <br />,
+  "
+",
+]
+`;
+
+exports[`HTMLReactParser parses HTML with newlines 3`] = `
+[
+  "
+",
+  <br />,
+  "
+",
+]
+`;
+
+exports[`HTMLReactParser parses HTML with newlines 4`] = `
+<p>
+  foo
+bar
+</p>
+`;
+
+exports[`HTMLReactParser parses HTML with newlines 5`] = `
+[
+  <p>
+    foo
+  </p>,
+  "
+bar",
+]
+`;
+
+exports[`HTMLReactParser parses HTML with newlines 6`] = `
+[
+  "foo",
+  <p>
+    
+
+bar
+  </p>,
+  "
+",
+]
+`;
diff --git a/__tests__/index.test.tsx b/__tests__/index.test.tsx
index 695e26f..55756f9 100644
--- a/__tests__/index.test.tsx
+++ b/__tests__/index.test.tsx
@@ -39,13 +39,30 @@ describe('HTMLReactParser', () => {
     },
   );
 
-  it('parses "" to []', () => {
+  it('parses empty string to empty array', () => {
     expect(parse('')).toEqual([]);
   });
 
-  it("returns string if it's not HTML", () => {
-    const string = 'text';
-    expect(parse(string)).toBe(string);
+  it.each(['a', 'text'])('parses string', (text) => {
+    expect(parse(text)).toBe(text);
+  });
+
+  it.each(['\n', '\r', '\n\r', 'foo\nbar', 'foo\rbar', 'foo\n\rbar\r'])(
+    'parses string with newlines %p',
+    (text) => {
+      expect(parse(text)).toBe(text);
+    },
+  );
+
+  it.each([
+    '\n<br>',
+    '<br>\r',
+    '\n<br>\r',
+    '<p>foo\nbar\r</p>',
+    '<p>foo</p>\rbar',
+    'foo<p>\n\rbar</p>\r',
+  ])('parses HTML with newlines', (html) => {
+    expect(parse(html)).toMatchSnapshot();
   });
 
   it('parses single HTML element', () => {