Allow rendering sanitized HTML tags in arcade showcase

This commit is contained in:
Max Wofford 2024-08-20 12:26:46 -04:00
parent aed5c3bc39
commit 2fcfc03766
3 changed files with 22 additions and 0 deletions

View file

@ -1,5 +1,7 @@
import ReactMarkdown from 'react-markdown'
import remarkGfm from 'remark-gfm'
import rehypeRaw from 'rehype-raw'
import rehypeSanitize from 'rehype-sanitize'
import style from './readme-renderer.module.css'
const ReadmeRenderer = ({ markdown }) => {
@ -7,6 +9,7 @@ const ReadmeRenderer = ({ markdown }) => {
<ReactMarkdown
className={style.reactMarkDown}
remarkPlugins={[remarkGfm]}
rehypePlugins={[rehypeRaw, rehypeSanitize]}
linkTarget={'_blank'}
>
{markdown}

View file

@ -85,6 +85,8 @@
"react-use-websocket": "^4.8.1",
"react-wrap-balancer": "^1.1.0",
"recharts": "2.12.2",
"rehype-raw": "^7.0.0",
"rehype-sanitize": "^6.0.0",
"remark": "^15.0.1",
"remark-gfm": "^3.0.1",
"remark-html": "^16.0.1",

View file

@ -7808,6 +7808,15 @@ rehype-raw@^5.0.0:
dependencies:
hast-util-raw "^6.1.0"
rehype-raw@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/rehype-raw/-/rehype-raw-7.0.0.tgz#59d7348fd5dbef3807bbaa1d443efd2dd85ecee4"
integrity sha512-/aE8hCfKlQeA8LmyeyQvQF3eBiLRGNlfBJEvWH7ivp9sBqs7TNqBL5X3v157rM4IFETqDnIOO+z5M/biZbo9Ww==
dependencies:
"@types/hast" "^3.0.0"
hast-util-raw "^9.0.0"
vfile "^6.0.0"
rehype-sanitize@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/rehype-sanitize/-/rehype-sanitize-4.0.0.tgz#b5241cf66bcedc49cd4e924a5f7a252f00a151ad"
@ -7815,6 +7824,14 @@ rehype-sanitize@^4.0.0:
dependencies:
hast-util-sanitize "^3.0.0"
rehype-sanitize@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/rehype-sanitize/-/rehype-sanitize-6.0.0.tgz#16e95f4a67a69cbf0f79e113c8e0df48203db73c"
integrity sha512-CsnhKNsyI8Tub6L4sm5ZFsme4puGfc6pYylvXo1AeqaGbjOYyzNv3qZPwvs0oMJ39eryyeOdmxwUIo94IpEhqg==
dependencies:
"@types/hast" "^3.0.0"
hast-util-sanitize "^5.0.0"
rehype-stringify@^8.0.0:
version "8.0.0"
resolved "https://registry.yarnpkg.com/rehype-stringify/-/rehype-stringify-8.0.0.tgz#9b6afb599bcf3165f10f93fc8548f9a03d2ec2ba"