Skip to content

Commit 43ee127

Browse files
authored
Merge pull request #369 from scientist-softserv/enable-rendering-html
Render html with react-markdown rehype-raw plugin
2 parents 9d9e565 + c8730b7 commit 43ee127

File tree

3 files changed

+95
-2
lines changed

3 files changed

+95
-2
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"react": "18.2.0",
3535
"react-dom": "18.2.0",
3636
"react-markdown": "^9.0.1",
37+
"rehype-raw": "^7.0.0",
3738
"sass": "^1.56.1",
3839
"start-server-and-test": "^2.0.3",
3940
"swr": "^1.3.0"

pages/browse/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
SearchBar,
88
} from '@scientist-softserv/webstore-component-library'
99
import Markdown from 'react-markdown'
10+
import rehypeRaw from 'rehype-raw'
1011
import {
1112
buttonBg,
1213
configureErrors,
@@ -69,12 +70,12 @@ const Browse = ({ session }) => {
6970
<Item
7071
key={service.id}
7172
markdownDescriptionTruncated={(
72-
<Markdown>
73+
<Markdown rehypePlugins={[rehypeRaw]}>
7374
{truncated}
7475
</Markdown>
7576
)}
7677
markdownDescriptionExtended={(
77-
<Markdown>
78+
<Markdown rehypePlugins={[rehypeRaw]}>
7879
{service?.description?.slice(cutOffIndex).trimStart()}
7980
</Markdown>
8081
)}

yarn.lock

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4459,6 +4459,46 @@ hasown@^2.0.0:
44594459
dependencies:
44604460
function-bind "^1.1.2"
44614461

4462+
hast-util-from-parse5@^8.0.0:
4463+
version "8.0.1"
4464+
resolved "https://registry.yarnpkg.com/hast-util-from-parse5/-/hast-util-from-parse5-8.0.1.tgz#654a5676a41211e14ee80d1b1758c399a0327651"
4465+
integrity sha512-Er/Iixbc7IEa7r/XLtuG52zoqn/b3Xng/w6aZQ0xGVxzhw5xUFxcRqdPzP6yFi/4HBYRaifaI5fQ1RH8n0ZeOQ==
4466+
dependencies:
4467+
"@types/hast" "^3.0.0"
4468+
"@types/unist" "^3.0.0"
4469+
devlop "^1.0.0"
4470+
hastscript "^8.0.0"
4471+
property-information "^6.0.0"
4472+
vfile "^6.0.0"
4473+
vfile-location "^5.0.0"
4474+
web-namespaces "^2.0.0"
4475+
4476+
hast-util-parse-selector@^4.0.0:
4477+
version "4.0.0"
4478+
resolved "https://registry.yarnpkg.com/hast-util-parse-selector/-/hast-util-parse-selector-4.0.0.tgz#352879fa86e25616036037dd8931fb5f34cb4a27"
4479+
integrity sha512-wkQCkSYoOGCRKERFWcxMVMOcYE2K1AaNLU8DXS9arxnLOUEWbOXKXiJUNzEpqZ3JOKpnha3jkFrumEjVliDe7A==
4480+
dependencies:
4481+
"@types/hast" "^3.0.0"
4482+
4483+
hast-util-raw@^9.0.0:
4484+
version "9.0.2"
4485+
resolved "https://registry.yarnpkg.com/hast-util-raw/-/hast-util-raw-9.0.2.tgz#39b4a4886bd9f0a5dd42e86d02c966c2c152884c"
4486+
integrity sha512-PldBy71wO9Uq1kyaMch9AHIghtQvIwxBUkv823pKmkTM3oV1JxtsTNYdevMxvUHqcnOAuO65JKU2+0NOxc2ksA==
4487+
dependencies:
4488+
"@types/hast" "^3.0.0"
4489+
"@types/unist" "^3.0.0"
4490+
"@ungap/structured-clone" "^1.0.0"
4491+
hast-util-from-parse5 "^8.0.0"
4492+
hast-util-to-parse5 "^8.0.0"
4493+
html-void-elements "^3.0.0"
4494+
mdast-util-to-hast "^13.0.0"
4495+
parse5 "^7.0.0"
4496+
unist-util-position "^5.0.0"
4497+
unist-util-visit "^5.0.0"
4498+
vfile "^6.0.0"
4499+
web-namespaces "^2.0.0"
4500+
zwitch "^2.0.0"
4501+
44624502
hast-util-to-jsx-runtime@^2.0.0:
44634503
version "2.3.0"
44644504
resolved "https://registry.yarnpkg.com/hast-util-to-jsx-runtime/-/hast-util-to-jsx-runtime-2.3.0.tgz#3ed27caf8dc175080117706bf7269404a0aa4f7c"
@@ -4480,13 +4520,37 @@ hast-util-to-jsx-runtime@^2.0.0:
44804520
unist-util-position "^5.0.0"
44814521
vfile-message "^4.0.0"
44824522

4523+
hast-util-to-parse5@^8.0.0:
4524+
version "8.0.0"
4525+
resolved "https://registry.yarnpkg.com/hast-util-to-parse5/-/hast-util-to-parse5-8.0.0.tgz#477cd42d278d4f036bc2ea58586130f6f39ee6ed"
4526+
integrity sha512-3KKrV5ZVI8if87DVSi1vDeByYrkGzg4mEfeu4alwgmmIeARiBLKCZS2uw5Gb6nU9x9Yufyj3iudm6i7nl52PFw==
4527+
dependencies:
4528+
"@types/hast" "^3.0.0"
4529+
comma-separated-tokens "^2.0.0"
4530+
devlop "^1.0.0"
4531+
property-information "^6.0.0"
4532+
space-separated-tokens "^2.0.0"
4533+
web-namespaces "^2.0.0"
4534+
zwitch "^2.0.0"
4535+
44834536
hast-util-whitespace@^3.0.0:
44844537
version "3.0.0"
44854538
resolved "https://registry.yarnpkg.com/hast-util-whitespace/-/hast-util-whitespace-3.0.0.tgz#7778ed9d3c92dd9e8c5c8f648a49c21fc51cb621"
44864539
integrity sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==
44874540
dependencies:
44884541
"@types/hast" "^3.0.0"
44894542

4543+
hastscript@^8.0.0:
4544+
version "8.0.0"
4545+
resolved "https://registry.yarnpkg.com/hastscript/-/hastscript-8.0.0.tgz#4ef795ec8dee867101b9f23cc830d4baf4fd781a"
4546+
integrity sha512-dMOtzCEd3ABUeSIISmrETiKuyydk1w0pa+gE/uormcTpSYuaNJPbX1NU3JLyscSLjwAQM8bWMhhIlnCqnRvDTw==
4547+
dependencies:
4548+
"@types/hast" "^3.0.0"
4549+
comma-separated-tokens "^2.0.0"
4550+
hast-util-parse-selector "^4.0.0"
4551+
property-information "^6.0.0"
4552+
space-separated-tokens "^2.0.0"
4553+
44904554
hoist-non-react-statics@^3.0.0, hoist-non-react-statics@^3.3.0, hoist-non-react-statics@^3.3.2:
44914555
version "3.3.2"
44924556
resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz#ece0acaf71d62c2969c2ec59feff42a4b1a85b45"
@@ -4511,6 +4575,11 @@ html-url-attributes@^3.0.0:
45114575
resolved "https://registry.yarnpkg.com/html-url-attributes/-/html-url-attributes-3.0.0.tgz#fc4abf0c3fb437e2329c678b80abb3c62cff6f08"
45124576
integrity sha512-/sXbVCWayk6GDVg3ctOX6nxaVj7So40FcFAnWlWGNAB1LpYKcV5Cd10APjPjW80O7zYW2MsjBV4zZ7IZO5fVow==
45134577

4578+
html-void-elements@^3.0.0:
4579+
version "3.0.0"
4580+
resolved "https://registry.yarnpkg.com/html-void-elements/-/html-void-elements-3.0.0.tgz#fc9dbd84af9e747249034d4d62602def6517f1d7"
4581+
integrity sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg==
4582+
45144583
http-cache-semantics@^4.1.1:
45154584
version "4.1.1"
45164585
resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz#abe02fcb2985460bf0323be664436ec3476a6d5a"
@@ -7618,6 +7687,15 @@ registry-url@^6.0.0:
76187687
dependencies:
76197688
rc "1.2.8"
76207689

7690+
rehype-raw@^7.0.0:
7691+
version "7.0.0"
7692+
resolved "https://registry.yarnpkg.com/rehype-raw/-/rehype-raw-7.0.0.tgz#59d7348fd5dbef3807bbaa1d443efd2dd85ecee4"
7693+
integrity sha512-/aE8hCfKlQeA8LmyeyQvQF3eBiLRGNlfBJEvWH7ivp9sBqs7TNqBL5X3v157rM4IFETqDnIOO+z5M/biZbo9Ww==
7694+
dependencies:
7695+
"@types/hast" "^3.0.0"
7696+
hast-util-raw "^9.0.0"
7697+
vfile "^6.0.0"
7698+
76217699
release-it@^15.6.0:
76227700
version "15.7.0"
76237701
resolved "https://registry.yarnpkg.com/release-it/-/release-it-15.7.0.tgz#9ea011208710736b5173e3691b48b6f719622c65"
@@ -8874,6 +8952,14 @@ [email protected]:
88748952
core-util-is "1.0.2"
88758953
extsprintf "^1.2.0"
88768954

8955+
vfile-location@^5.0.0:
8956+
version "5.0.2"
8957+
resolved "https://registry.yarnpkg.com/vfile-location/-/vfile-location-5.0.2.tgz#220d9ca1ab6f8b2504a4db398f7ebc149f9cb464"
8958+
integrity sha512-NXPYyxyBSH7zB5U6+3uDdd6Nybz6o6/od9rk8bp9H8GR3L+cm/fC0uUTbqBmUTnMCUDslAGBOIKNfvvb+gGlDg==
8959+
dependencies:
8960+
"@types/unist" "^3.0.0"
8961+
vfile "^6.0.0"
8962+
88778963
vfile-message@^4.0.0:
88788964
version "4.0.2"
88798965
resolved "https://registry.yarnpkg.com/vfile-message/-/vfile-message-4.0.2.tgz#c883c9f677c72c166362fd635f21fc165a7d1181"
@@ -8938,6 +9024,11 @@ wcwidth@^1.0.1:
89389024
dependencies:
89399025
defaults "^1.0.3"
89409026

9027+
web-namespaces@^2.0.0:
9028+
version "2.0.1"
9029+
resolved "https://registry.yarnpkg.com/web-namespaces/-/web-namespaces-2.0.1.tgz#1010ff7c650eccb2592cebeeaf9a1b253fd40692"
9030+
integrity sha512-bKr1DkiNa2krS7qxNtdrtHAmzuYGFQLiQ13TsorsdT6ULTkPLKuu5+GsFpDlg6JFjUTwX2DyhMPG2be8uPrqsQ==
9031+
89419032
web-streams-polyfill@^3.0.3:
89429033
version "3.2.1"
89439034
resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz#71c2718c52b45fd49dbeee88634b3a60ceab42a6"

0 commit comments

Comments
 (0)