Skip to content

Commit

Permalink
Fixes: gr.Markdown is not updated properly when it has an image tag (#…
Browse files Browse the repository at this point in the history
…7623)

* fix

* add changeset

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
  • Loading branch information
3 people committed Mar 19, 2024
1 parent 41385f4 commit c9aba8d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
6 changes: 6 additions & 0 deletions .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
14 changes: 10 additions & 4 deletions js/markdown/shared/MarkdownCode.svelte
Expand Up @@ -61,10 +61,16 @@
}
async function render_html(value: string): Promise<void> {
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));
Expand Down

0 comments on commit c9aba8d

Please sign in to comment.