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

Syntax Highlighting breaks for blame view when some line of a chain call is commented #6895

Closed
2 of 7 tasks
eldiaboloz opened this issue May 9, 2019 · 4 comments
Closed
2 of 7 tasks
Labels
topic/ui Change the appearance of the Gitea UI
Milestone

Comments

@eldiaboloz
Copy link
Contributor

eldiaboloz commented May 9, 2019

  • Gitea version (or commit ref): 1.9.0+dev-217-g91c2c237f
  • Git version: 2.21.0
  • Operating system: Arch Linux
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

Hello,
as per title: In blame view, if you comment some line after the first line of a chain, the syntax highlighting is broken to the end of file. Tried with php and java files.
here are examples:
https://try.gitea.io/TbHG1AUy7x7vkj10/test-blame-bug/blame/branch/master/HelloWorld.java
https://try.gitea.io/TbHG1AUy7x7vkj10/test-blame-bug/blame/branch/master/index.php

Screenshots

https://i.imgur.com/XcvSXpS.png
https://i.imgur.com/ISWfM76.png

@silverwind
Copy link
Member

silverwind commented May 9, 2019

Your languages are detected correctly in those examples, which means this is a highlight.js bug, report it there instead.

@eldiaboloz
Copy link
Contributor Author

Thanks for pointing me in the right direction.

TLDR: there needs to be new lines in the html after every line of code for highlight.js to work correctly

After some fiddling with highlight.js and looking at the source
and the comment regexes, and comparing the html source generated for the "normal" and "blame" views in gitea, there was a little difference:
https://github.com/go-gitea/gitea/blob/master/routers/repo/blame.go#L239
https://github.com/go-gitea/gitea/blob/master/routers/repo/view.go#L313
so a simple change fixed the issue eldiaboloz@bf39e6f

@lunny
Copy link
Member

lunny commented May 11, 2019

@eldiaboloz please send a PR

eldiaboloz added a commit to eldiaboloz/gitea that referenced this issue May 11, 2019
@eldiaboloz
Copy link
Contributor Author

PR sent 6909

@lafriks lafriks added the topic/ui Change the appearance of the Gitea UI label May 11, 2019
@lafriks lafriks added this to the 1.9.0 milestone May 11, 2019
@lafriks lafriks closed this as completed May 11, 2019
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
topic/ui Change the appearance of the Gitea UI
Projects
None yet
Development

No branches or pull requests

4 participants