Skip to content

Handle codehilite elements with multiple classes #933

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

Closed
PIG208 opened this issue Sep 9, 2024 · 3 comments · Fixed by #1021
Closed

Handle codehilite elements with multiple classes #933

PIG208 opened this issue Sep 9, 2024 · 3 comments · Fixed by #1021
Assignees
Labels
a-content Parsing and rendering Zulip HTML content, notably message contents

Comments

@PIG208
Copy link
Member

PIG208 commented Sep 9, 2024

It is totally possible for Pygments to generate HTML elements with more than one classes.

This is considered quite an edge case and only happens to some languages, such as PostgreSQL (see pygments/pygments#2780). It currently renders as an unimplemented feature whenever a code block contains tokens with more than one classes.

See a minimal example here.

HTML of the unsupported message:

<pre>
  <span></span>
  <code>
    <span class="s s-Name">"</span>
  </code>
</pre>
@PIG208 PIG208 added this to the Launch milestone Sep 9, 2024
@PIG208 PIG208 added the a-content Parsing and rendering Zulip HTML content, notably message contents label Sep 9, 2024
@PIG208
Copy link
Member Author

PIG208 commented Sep 12, 2024

Listed under #921.

@gnprice
Copy link
Member

gnprice commented Sep 25, 2024

Other than PostgreSQL, this apparently happens with YAML. Here's a test message.

@PIG208
Copy link
Member Author

PIG208 commented Sep 26, 2024

For these kind of messages, we should be able to safely apply the style of the most specific known class from the class list. These non-standard token types usually aren't likely to be handled by styles. We could also maintain a list of unexpected token types, but that does not seem necessary.

rajveermalviya added a commit to rajveermalviya/zulip-flutter that referenced this issue Oct 23, 2024
@rajveermalviya rajveermalviya self-assigned this Oct 23, 2024
rajveermalviya added a commit to rajveermalviya/zulip-flutter that referenced this issue Oct 24, 2024
rajveermalviya added a commit to rajveermalviya/zulip-flutter that referenced this issue Oct 25, 2024
rajveermalviya added a commit to rajveermalviya/zulip-flutter that referenced this issue Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a-content Parsing and rendering Zulip HTML content, notably message contents
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants