fix markdown entity decoding for inline code

This commit is contained in:
Shantur Rathore
2025-10-31 11:19:13 +00:00
parent 505a06de05
commit b669074106
2 changed files with 67 additions and 15 deletions

View File

@@ -1,5 +1,5 @@
import { createEffect, createSignal, onMount, onCleanup } from "solid-js"
import { renderMarkdown, onLanguagesLoaded, initMarkdown } from "../lib/markdown"
import { renderMarkdown, onLanguagesLoaded, initMarkdown, decodeHtmlEntities } from "../lib/markdown"
import type { TextPart } from "../types/message"
interface MarkdownProps {
@@ -15,7 +15,8 @@ export function Markdown(props: MarkdownProps) {
createEffect(async () => {
const part = props.part
const text = part.text || ""
const rawText = typeof part.text === "string" ? part.text : ""
const text = decodeHtmlEntities(rawText)
const dark = Boolean(props.isDark)
const themeKey = dark ? "dark" : "light"
@@ -72,7 +73,8 @@ export function Markdown(props: MarkdownProps) {
// Register listener for language loading completion
const cleanupLanguageListener = onLanguagesLoaded(async () => {
const part = props.part
const text = part.text || ""
const rawText = typeof part.text === "string" ? part.text : ""
const text = decodeHtmlEntities(rawText)
if (latestRequestedText !== text) {
return