-
Notifications
You must be signed in to change notification settings - Fork 65
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
Markdown/Code block compatible output #358
Markdown/Code block compatible output #358
Conversation
Great Feature, would like to see it added. |
Can confirm this works pretty nice for us 👍 Thanks |
MarkdownReports are a special kind of human readable reports, and are reusing the HumanReport code, but adapt the styling to conform to diff syntax highlighting where necessary Signed-off-by: Mathias Petermann <mathias.petermann@gmail.com>
Making the prefixes for blocks and paths configurable enables to make the diff syntax compatible with different code highlighters For code blocks table output doesn't make sense, so it's always disabled For multiline changes like binary and certificates, the whole block should be prefixed Signed-off-by: Mathias Petermann <mathias.petermann@gmail.com>
1878428
to
f8890da
Compare
@HeavyWombat Any chance to get some general feedback, or a review on this? I've rebased the changes to the latest state of main |
Thanks! I've been really busy lately, but still try to allocate time for my open-source projects. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #358 +/- ##
==========================================
- Coverage 83.62% 81.24% -2.39%
==========================================
Files 14 15 +1
Lines 1527 1658 +131
==========================================
+ Hits 1277 1347 +70
- Misses 184 239 +55
- Partials 66 72 +6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
Thank you very much for this addition and I am sorry that you had to wade through some very old and ugly code of mine there.
Nothing to be sorry about! Thanks for developing this cool tool :) |
The current output, while very readable, isn't compatible with syntax highlighting in markdown code blocks. Generally the code block output, is a special kind of human readable output, which needs to the very strict syntaxes of the highlighting library used.
What seems to be common is the requirement that the modifier, to highlight the line, needs to be at the beginning of the line without indentation, and only a full line can be highlighted (not single letters)
This pull requests implements a
diff
syntax highlighting compatible output, based on theHumanReport
, with removed indentations, and a different prefix for paths, RootDescriptions and changeTypes (to avoid highlighting the introduction line for additiona & removal).Additionally since only full lines can be coloured, the table style is disabled and multiline (as well as binary and certificate) changes, are prefixed continuously.
Using configurable prefixes, it's possible to easily support the Markdown code block on GitHub, GitLab, and Gitea/Forgejo, while ensuring it's easy to add support for further highlighting libraries (eg. for Bitbucket)
Fixes #325