Skip to content

Commit

Permalink
fix:use innerText to escape htmlString when showRawCode is on (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
CNSeniorious000 committed May 17, 2023
1 parent 9d4dc32 commit 58b7a52
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/components/Markdown.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Show } from 'solid-js'
import { unified } from 'unified'
import remarkParse from 'remark-parse'
import remarkGfm from 'remark-gfm'
Expand Down Expand Up @@ -31,9 +32,8 @@ export default (props: Props) => {
const htmlString = () => props.showRawCode ? props.text : parseMarkdown(props.text)

return (
<div
class={`${props.class ?? ''} ${props.showRawCode ? 'whitespace-pre-wrap overflow-auto my-0' : ''}`}
innerHTML={htmlString()}
/>
<Show when={props.showRawCode} fallback={<div class={props.class ?? ''} innerHTML={htmlString()} />}>
<div class={`${props.class ?? ''} whitespace-pre-wrap overflow-auto my-0`} innerText={htmlString()} />
</Show>
)
}

0 comments on commit 58b7a52

Please sign in to comment.