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

Escape angle brackets in markdown for summary #167

Closed
eisaev opened this issue Apr 21, 2023 · 2 comments
Closed

Escape angle brackets in markdown for summary #167

eisaev opened this issue Apr 21, 2023 · 2 comments

Comments

@eisaev
Copy link

eisaev commented Apr 21, 2023

If you have angle brackets in the case name, it is displayed incomplete. It looks like that:
Job output

[...]
----------------------------------------------------------------------------------
Benchmark                                        Time             CPU   Iterations
----------------------------------------------------------------------------------
Parser<AlertCategoryIDBitMask>                66.4 ns         66.4 ns     1039[72](https://github.com/eisaev/blevalueparser/actions/runs/4764381427/jobs/8468898651#step:6:73)77
Parser<AlertCategoryID>                       67.0 ns         66.9 ns     10341586
Parser<AlertNotificationControlPoint>         69.7 ns         69.7 ns     10021209
Parser<BatteryCriticalStatus>                 66.6 ns         66.6 ns     10559445
[...]

Summary

[...]
Parser | `66.37376363055044` ns/iter | `67.18023075810773` ns/iter | 0.99
Parser | `66.95329575172786` ns/iter | `68.18596605911337` ns/iter | 0.98
Parser | `69.71105133122411` ns/iter | `69.81726765475584` ns/iter | 1.00
Parser | `66.59934996590181` ns/iter | `66.55876908651649` ns/iter | 1.00
[...]

This is because GitHub markdown treats it as HTML tag. So we need to escape angle brackets like this:
Parser<AlertCategoryID> -> Parser\<AlertCategoryID>

See also:

@eisaev
Copy link
Author

eisaev commented Apr 23, 2023

I added this workaround in my workflow:

    # Workaround for GitHub Markdown (see https://github.com/benchmark-action/github-action-benchmark/issues/167)
    - name: Names Workaround
      working-directory: ${{env.BUILD_DIR}}/benchmarks
      run: sed -i 's/</\&lt;/g;s/>/\&gt;/g' benchmark-results.json

I use Linux machines for benchmark tasks. If you use different platform you should adapt this. For example, on macOS you have to use gsed (GNU sed) with same command line arguments or use native sed (BSD sed) with other arguments, because BSD sed has different options and behaviour.

UPD: Unfortunately, this workaround also affects alert comments and they look ugly :(

@ktrz
Copy link
Member

ktrz commented Jan 30, 2024

This got fixed by #218 and got released in v1.19.2. Now we use the same approach for generating comment, alert and summary. Therefore they all should be working fine :)

Verified here
Screenshot 2024-01-30 at 16 42 08

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

No branches or pull requests

2 participants