mirror of
https://github.com/gradio-app/gradio.git
synced 2024-11-21 01:01:05 +08:00
Fixes: gr.Markdown is not updated properly when it has an image tag (#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>
This commit is contained in:
parent
41385f402b
commit
c9aba8d8a5
6
.changeset/plenty-paths-sing.md
Normal file
6
.changeset/plenty-paths-sing.md
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
"@gradio/markdown": patch
|
||||
"gradio": patch
|
||||
---
|
||||
|
||||
fix:Fixes: gr.Markdown is not updated properly when it has an image tag
|
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user