-
Notifications
You must be signed in to change notification settings - Fork 205
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
Make Markdown rendering 10 times faster #2232
Conversation
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.
(see next comment)
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.
Looks very nice and clean. As mentioned in before this would break any currently generated test reports by http://github.com/os-autoinst/openqa_review pasted into comment fields on an openQA instance which has this. You can prevent this by either patching this or maybe it is just enough to announce on an according mailing list about this change. Maybe it is not even relevant anymore for test and reporting workflows.
Codecov Report
@@ Coverage Diff @@
## master #2232 +/- ##
==========================================
+ Coverage 85.89% 85.96% +0.06%
==========================================
Files 164 165 +1
Lines 10807 10823 +16
==========================================
+ Hits 9283 9304 +21
+ Misses 1524 1519 -5
Continue to review full report at Codecov.
|
Patch for openQA review: os-autoinst/openqa_review#126 |
…tter comment rendering speed and security
It seems like the second commit is kind of unnecessary now, as everything it does is replaced by the third commit - at least AFAICS. Couldn't it just be ditched? |
Or, well, I guess, more the last two commits could be sort of squashed together and the bit where HTML::Restrict is used and then immediately ripped out again could be avoided. |
squashing is if one commit fixes another - these commits are just revisions. So I don't see the requirement to squash |
This is the promised followup to #2228. It replaces
Text::Markdown
withCommonMark
(which uses the standard cmark library) for comment rendering. Similar to how OBS already handles Markdown. It is at least 10 times faster for most cases, and has very solid security features.While this should resolve our performance bottlenecks when rendering comments, there are a few changes to be aware of. Raw HTML is no longer allowed in comments (it is simply removed), since there is no way to sanitize HTML fast enough. Instead we now have custom template tags to generate text in different colors.
## This is an example comment {{color:#ff0000|This text will be red with a white background}} {{color:#00ff00|This text will be green with a white background}} {{color:#ffffff|This text will be white with a black background}} This text will have the standard color.
There is also new logic to change the background color to black if a light text color is chosen.