-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix md highlight #6842
Fix md highlight #6842
Conversation
@@ -128,28 +127,26 @@ export function create_marked({ | |||
); | |||
|
|||
if (header_links) { | |||
if (header_links) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dno why we had this double if
@@ -110,6 +107,8 @@ export function create_marked({ | |||
header_links: boolean; | |||
line_breaks: boolean; | |||
}): typeof marked { | |||
const marked = new Marked(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fresh instance per 'create_marked`.
🪼 branch checks and previews
Install Gradio from this PR pip install https://gradio-builds.s3.amazonaws.com/cd6393bc3fbf084578de5a5c3f04a54af087a610/gradio-4.10.0-py3-none-any.whl Install Gradio Python Client from this PR pip install "gradio-client @ git+https://github.com/gradio-app/gradio@cd6393bc3fbf084578de5a5c3f04a54af087a610#subdirectory=client/python" |
🦄 change detectedThis Pull Request includes changes to the following packages.
With the following changelog entry.
Maintainers or the PR author can modify the PR title to modify this entry.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We were basically adding all plugins to the same renderer for every instance of the component. So 2 instances would be 2 highlighters. And i think that basically meant that the highlighted code was being passed through the highlighter again (but at that point it was html code).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM thanks for the fix @pngwn!
* ensure gr.Markdown instances have their own instance of the markdown renderer * fix demo * add changeset * skopip test --------- Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Description
some weird issues as we were reusing the same marked instance across multiple instances of
gr.Markdown
. The issues only seems to present when more than on markdown component is used.https://marked.js.org/using_advanced#instance
The quickstart for marked is idiotic in the extreme but this should fix it.
🎯 PRs Should Target Issues
Before your create a PR, please check to see if there is an existing issue for this change. If not, please create an issue before you create this PR, unless the fix is very small.
Not adhering to this guideline will result in the PR being closed.
Tests
PRs will only be merged if tests pass on CI. To run the tests locally, please set up your Gradio environment locally and run the tests:
bash scripts/run_all_tests.sh
You may need to run the linters:
bash scripts/format_backend.sh
andbash scripts/format_frontend.sh