Skip to content

[WEB-4259] Fix Changelog description homepage #2575

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
"@ably/ui": "16.2.1",
"@codesandbox/sandpack-react": "^2.20.0",
"@codesandbox/sandpack-themes": "^2.0.21",
"@js-bits/dom-parser": "^1.0.3",
"@mdx-js/react": "^2.3.0",
"@react-hook/media-query": "^1.1.1",
"@types/cheerio": "^0.22.31",
Expand Down
13 changes: 10 additions & 3 deletions src/components/Homepage/Changelog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { Key } from 'react';
import Badge from '@ably/ui/core/Badge';
import FeaturedLink from '@ably/ui/core/FeaturedLink';
import Link from '../Link';
import parse from '@js-bits/dom-parser';

interface ChangelogFeedItemNode {
title: string;
Expand Down Expand Up @@ -84,8 +83,16 @@ const stripHtml = (html: string | null | undefined): string => {
if (!html) {
return '';
}
const doc = parse(html);
return doc.textContent || '';

const parser = new DOMParser();
const doc = parser.parseFromString(html, 'text/html');

const firstBodyChild = doc.body.firstChild;
if (firstBodyChild?.nodeName?.toLowerCase() === 'parsererror') {
return '';
}

return doc.body.textContent || '';
};

const parseChangelogContent = (htmlContent: string): { tags: string[]; description: string } => {
Expand Down
91 changes: 4 additions & 87 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2166,19 +2166,6 @@
"@jridgewell/resolve-uri" "^3.1.0"
"@jridgewell/sourcemap-codec" "^1.4.14"

"@js-bits/dom-parser@^1.0.3":
version "1.0.3"
resolved "https://registry.yarnpkg.com/@js-bits/dom-parser/-/dom-parser-1.0.3.tgz#687f19841804f5921568c8203fec7a635daecdb2"
integrity sha512-daXMHErUBCuS3FLX0TWL0+Tt2F1Tmds0y2ZdbV2EPjnUK/G6f6j+qJQoIe4DF3/n+Zmu3xszt9DjQqmDlA42ow==
dependencies:
"@js-bits/typedef-utils" "^1.0.7"
jsdom "^22.1.0"

"@js-bits/typedef-utils@^1.0.7":
version "1.0.7"
resolved "https://registry.yarnpkg.com/@js-bits/typedef-utils/-/typedef-utils-1.0.7.tgz#a1686391c0d3d338608ffe652b66c2c1d45e958a"
integrity sha512-vnJmtK4gG3yQe3nv1QGgxXSxGpnDbf7GzWSsTCYstf/LQf0XbuDsV2eslfeaYCJeNJCS1QoPXOUZxWKZehlh3Q==

"@lezer/common@^1.0.0", "@lezer/common@^1.0.2", "@lezer/common@^1.1.0", "@lezer/common@^1.2.0":
version "1.2.1"
resolved "https://registry.npmjs.org/@lezer/common/-/common-1.2.1.tgz"
Expand Down Expand Up @@ -6330,13 +6317,6 @@ cssstyle@^2.3.0:
dependencies:
cssom "~0.3.6"

cssstyle@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-3.0.0.tgz#17ca9c87d26eac764bb8cfd00583cff21ce0277a"
integrity sha512-N4u2ABATi3Qplzf0hWbVCdjenim8F3ojEXpBDF5hBpjzW182MjNGLqfmQ0SkSPeQ+V86ZXgeH8aXj6kayd4jgg==
dependencies:
rrweb-cssom "^0.6.0"

csstype@^3.0.2:
version "3.1.3"
resolved "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz"
Expand Down Expand Up @@ -6364,15 +6344,6 @@ data-urls@^3.0.2:
whatwg-mimetype "^3.0.0"
whatwg-url "^11.0.0"

data-urls@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/data-urls/-/data-urls-4.0.0.tgz#333a454eca6f9a5b7b0f1013ff89074c3f522dd4"
integrity sha512-/mMTei/JXPqvFqQtfyTowxmJVwr2PVAeCcDxyFf6LhoOu/09TX2OX3kb2wzi4DMXcfj4OItwDOnhl5oziPnT6g==
dependencies:
abab "^2.0.6"
whatwg-mimetype "^3.0.0"
whatwg-url "^12.0.0"

date-fns@^2.30.0:
version "2.30.0"
resolved "https://registry.npmjs.org/date-fns/-/date-fns-2.30.0.tgz"
Expand Down Expand Up @@ -6406,7 +6377,7 @@ decamelize@^1.2.0:
resolved "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz"
integrity sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==

decimal.js@^10.4.2, decimal.js@^10.4.3:
decimal.js@^10.4.2:
version "10.5.0"
resolved "https://registry.npmjs.org/decimal.js/-/decimal.js-10.5.0.tgz"
integrity sha512-8vDa8Qxvr/+d94hSh5P3IJwI5t8/c0KsMp+g8bNw9cY2icONa5aPfvKeieW1WlG0WQYwwhJ7mjui2xtiePQSXw==
Expand Down Expand Up @@ -10753,35 +10724,6 @@ jsdom@^20.0.0:
ws "^8.11.0"
xml-name-validator "^4.0.0"

jsdom@^22.1.0:
version "22.1.0"
resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-22.1.0.tgz#0fca6d1a37fbeb7f4aac93d1090d782c56b611c8"
integrity sha512-/9AVW7xNbsBv6GfWho4TTNjEo9fe6Zhf9O7s0Fhhr3u+awPwAJMKwAMXnkk5vBxflqLW9hTHX/0cs+P3gW+cQw==
dependencies:
abab "^2.0.6"
cssstyle "^3.0.0"
data-urls "^4.0.0"
decimal.js "^10.4.3"
domexception "^4.0.0"
form-data "^4.0.0"
html-encoding-sniffer "^3.0.0"
http-proxy-agent "^5.0.0"
https-proxy-agent "^5.0.1"
is-potential-custom-element-name "^1.0.1"
nwsapi "^2.2.4"
parse5 "^7.1.2"
rrweb-cssom "^0.6.0"
saxes "^6.0.0"
symbol-tree "^3.2.4"
tough-cookie "^4.1.2"
w3c-xmlserializer "^4.0.0"
webidl-conversions "^7.0.0"
whatwg-encoding "^2.0.0"
whatwg-mimetype "^3.0.0"
whatwg-url "^12.0.1"
ws "^8.13.0"
xml-name-validator "^4.0.0"

jsesc@^2.5.1:
version "2.5.2"
resolved "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz"
Expand Down Expand Up @@ -12545,7 +12487,7 @@ nullthrows@^1.1.1:
resolved "https://registry.npmjs.org/nullthrows/-/nullthrows-1.1.1.tgz"
integrity sha512-2vPPEi+Z7WqML2jZYddDIfy5Dqb0r2fze2zTxNNknZaFpVHU3mFB3R+DWeJWGVx0ecvttSGlJTI+WG+8Z4cDWw==

nwsapi@^2.2.2, nwsapi@^2.2.4:
nwsapi@^2.2.2:
version "2.2.20"
resolved "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.20.tgz"
integrity sha512-/ieB+mDe4MrrKMT8z+mQL8klXydZWGR5Dowt4RAGKbJ3kIGEx3X4ljUo+6V73IXtUPWgfOlU5B9MlGxFO5T+cA==
Expand Down Expand Up @@ -12919,7 +12861,7 @@ parse5@^6.0.0:
resolved "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz"
integrity sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==

parse5@^7.0.0, parse5@^7.1.1, parse5@^7.1.2:
parse5@^7.0.0, parse5@^7.1.1:
version "7.3.0"
resolved "https://registry.npmjs.org/parse5/-/parse5-7.3.0.tgz"
integrity sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw==
Expand Down Expand Up @@ -13631,7 +13573,7 @@ pump@^3.0.0:
end-of-stream "^1.1.0"
once "^1.3.1"

punycode@^2.1.0, punycode@^2.1.1, punycode@^2.3.0, punycode@^2.3.1:
punycode@^2.1.0, punycode@^2.1.1, punycode@^2.3.1:
version "2.3.1"
resolved "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz"
integrity sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==
Expand Down Expand Up @@ -14370,11 +14312,6 @@ rrdom@^2.0.0-alpha.13:
dependencies:
rrweb-snapshot "^2.0.0-alpha.18"

rrweb-cssom@^0.6.0:
version "0.6.0"
resolved "https://registry.yarnpkg.com/rrweb-cssom/-/rrweb-cssom-0.6.0.tgz#ed298055b97cbddcdeb278f904857629dec5e0e1"
integrity sha512-APM0Gt1KoXBz0iIkkdB/kfvGOwC4UuJFeG/c+yV7wSc7q96cG/kJ0HiYCnzivD9SB53cLV1MlHFNfOuPaadYSw==

rrweb-snapshot@^2.0.0-alpha.13, rrweb-snapshot@^2.0.0-alpha.18:
version "2.0.0-alpha.18"
resolved "https://registry.npmjs.org/rrweb-snapshot/-/rrweb-snapshot-2.0.0-alpha.18.tgz"
Expand Down Expand Up @@ -15615,13 +15552,6 @@ tr46@^3.0.0:
dependencies:
punycode "^2.1.1"

tr46@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/tr46/-/tr46-4.1.1.tgz#281a758dcc82aeb4fe38c7dfe4d11a395aac8469"
integrity sha512-2lv/66T7e5yNyhAAC4NaKe5nVavzuGJQVVtRYLyQ2OI8tsJ61PMLlelehb0wi2Hx6+hT/OJUWZcw8MjlSRnxvw==
dependencies:
punycode "^2.3.0"

tr46@~0.0.3:
version "0.0.3"
resolved "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz"
Expand Down Expand Up @@ -16499,14 +16429,6 @@ whatwg-url@^11.0.0:
tr46 "^3.0.0"
webidl-conversions "^7.0.0"

whatwg-url@^12.0.0, whatwg-url@^12.0.1:
version "12.0.1"
resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-12.0.1.tgz#fd7bcc71192e7c3a2a97b9a8d6b094853ed8773c"
integrity sha512-Ed/LrqB8EPlGxjS+TrsXcpUond1mhccS3pchLhzSgPCnTimUCKj3IZE75pAs5m6heB2U2TMerKFUXheyHY+VDQ==
dependencies:
tr46 "^4.1.1"
webidl-conversions "^7.0.0"

whatwg-url@^5.0.0:
version "5.0.0"
resolved "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz"
Expand Down Expand Up @@ -16667,11 +16589,6 @@ ws@^8.11.0:
resolved "https://registry.yarnpkg.com/ws/-/ws-8.16.0.tgz#d1cd774f36fbc07165066a60e40323eab6446fd4"
integrity sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ==

ws@^8.13.0:
version "8.18.1"
resolved "https://registry.yarnpkg.com/ws/-/ws-8.18.1.tgz#ea131d3784e1dfdff91adb0a4a116b127515e3cb"
integrity sha512-RKW2aJZMXeMxVpnZ6bck+RswznaxmzdULiBr6KY7XkTnW8uvt0iT9H5DkHUChXrc+uurzwa0rVI16n/Xzjdz1w==

ws@~8.11.0:
version "8.11.0"
resolved "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz"
Expand Down