527e5bd1b2
Fix copy/paste of empty lines ( #19798 )
...
* Fix copy/paste of empty newlines again
Fixes: https://github.com/go-gitea/gitea/issues/19331
Regressed by: https://github.com/go-gitea/gitea/pull/18270
Needed to do another newline addition to the Chroma output HTML to get
copy/paste work again. The previous replacement conditions are probably
obsolete, but as I'm not 100% sure, I opted to keep them.
Specifically, the Chroma HTML change mentioned in
https://github.com/go-gitea/gitea/pull/18270#issuecomment-1013350246
broke our previous newline replacement for such empty lines.
Also included are a few changes to make the test more pleasant to work
with.
* run go mod tidy
* add util.Dedent
* copy in the code
Co-authored-by: techknowlogick <techknowlogick@gitea.io >
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com >
Co-authored-by: Lauris BH <lauris@nix.lv >
2022-06-10 21:45:28 +08:00
bbd30787d3
Updated Chroma to v0.10.0 ( #18270 )
2022-01-20 17:59:15 +08:00
3c4724d70e
Add .gitattribute assisted language detection to blame, diff and render ( #17590 )
...
Use check attribute code to check the assigned language of a file and send that in to
chroma as a hint for the language of the file.
Signed-off-by: Andrew Thornton <art27@cantab.net >
2021-11-17 20:37:00 +00:00
750a8465f5
A better go code formatter, and now make fmt
can run in Windows ( #17684 )
...
* go build / format tools
* re-format imports
2021-11-17 20:34:35 +08:00
f31e7a67cf
Just use a slice when rendering file ( #16774 )
...
Highlight currently uses a map which is memory inefficient. Switch to use a slice instead.
Signed-off-by: Andrew Thornton <art27@cantab.net >
2021-08-23 22:23:39 +01:00
23a87a003e
Ensure empty lines are copiable and final new line too ( #16678 )
...
* Ensure empty lines are copiable and final new line too
When files are highlighted the newline character needs to be added in a whitespace
compliant mode. Also ensure the final empty newline is rendered.
Fix #16434
* Add test and ensure spans closed
Signed-off-by: Andrew Thornton <art27@cantab.net >
2021-08-14 01:16:56 +02:00