diff --git a/.changeset/plenty-paths-sing.md b/.changeset/plenty-paths-sing.md new file mode 100644 index 0000000000..cfb7d93e1b --- /dev/null +++ b/.changeset/plenty-paths-sing.md @@ -0,0 +1,6 @@ +--- +"@gradio/markdown": patch +"gradio": patch +--- + +fix:Fixes: gr.Markdown is not updated properly when it has an image tag diff --git a/js/markdown/shared/MarkdownCode.svelte b/js/markdown/shared/MarkdownCode.svelte index 5d5cd63489..69391e1d81 100644 --- a/js/markdown/shared/MarkdownCode.svelte +++ b/js/markdown/shared/MarkdownCode.svelte @@ -61,10 +61,16 @@ } async function render_html(value: string): Promise { if (latex_delimiters.length > 0 && value) { - render_math_in_element(el, { - delimiters: latex_delimiters, - throwOnError: false - }); + const containsDelimiter = latex_delimiters.some( + (delimiter) => + value.includes(delimiter.left) && value.includes(delimiter.right) + ); + if (containsDelimiter) { + render_math_in_element(el, { + delimiters: latex_delimiters, + throwOnError: false + }); + } } } afterUpdate(() => render_html(message));