Skip to content
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

HTML conversion fixes and small improvements #1239

Merged
merged 4 commits into from
Oct 7, 2022

Conversation

Fs00
Copy link
Contributor

@Fs00 Fs00 commented Sep 18, 2022

This PR includes some changes to the HTML-to-spanned-text converter that fix some formatting inconsistencies between the app and the GitHub UI:

  • <pre> tags are now treated as code blocks (as the GitHub UI does) instead of being rendered as monospaced pre-formatted blocks without a background.
    This change also allows to simplify the handling of highlighted code blocks: they don't need to be handled in a special way since they are just pres wrapped in a div.
  • <tt> tags are now treated in the same way as <code> tags
  • <samp> tags are now rendered as simple monospaced inline text (they were previously ignored)
  • rendering of numbered lists was improved: nested <ol>s and ordered lists which have newlines between each item are now displayed correctly.
    This was done by implementing a custom LeadingMarginSpan to render the number (like 1. ) before the content of the list item. The implementation was inspired by this SO answer and by the BulletSpan implementation.
  • horizontal separators spacing has been fixed
  • in GH blog/wiki feed lists, HTML entities in the description preview of each item were not escaped. To address this, I've decided to escape only the most common entities in order to have a "good enough" solution. Otherwise, we would have to pull in a dedicated library to escape everything properly (which I think is not worth).
BeforeAfter

@maniac103 maniac103 merged commit 133ec76 into slapperwan:master Oct 7, 2022
@Fs00 Fs00 deleted the html-fixes branch October 7, 2022 10:04
@fixxxer87 fixxxer87 linked an issue Apr 2, 2023 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

There are separate PRs for the LTS releases.
2 participants