Repo: Undesirable Plain Text Syntax Highlighting #35
Closed
opened 6 years ago by Ghost
·
12 comments
Loading…
Reference in new issue
There is no content yet.
Delete Branch '%!s(MISSING)'
Deleting a branch is permanent. It CANNOT be undone. Continue?
Maybe because of the pygments implementation, plain text files started to get highlighted.
Test:
gogs.io example 1 - OK
teknik.io example 1
teknik.io example 2
teknik.io example 3
I checked the commits since the last release of gogs, and I don't see any that signify a change in the syntax highlighting.
Once thought is that the example on Gogs doesn't have an extension, while the ones here do. That could be throwing off the syntax highlighting, not sure.
The pygments implementation was only for Pastes, so this issue doesn't apply to it. The implementation for syntax highlighting in the git repos is handled by Gogs.
You're quite right. I assumed maybe it was related to pygments because I researched in advance in gogs issues and found Syntax highlighting is done on plain text LICENSE files which was fixed, but as you suggest, and correctly, it's only working for files with no extension.
The following example confirms that it's a gogs issue. I'll contact them.
Thanks and closing.
teknik.io example 4 - OK
[EDIT] Actually the gogs team fixed it only for files specifically named
LICENSE
! I can't believe this decision but I already posted a follow up to the syntax highlighting issue.Haha, wow that's a weird way that they fixed it. Thanks for bringing it to their attention (and mine!)
@Uncled1023 In the meantime, since I didn't get a response yet (I posted it as a new issue in gogs GH page), I found this thread on gogs, which added the ability to map extensions for syntax highlighting in config.
Commit
1e7e092992
Example
Now, since the objective is to not highlight plain text, what should the example above be like? Not sure if this solves it.
[EDIT] Maybe leaving the value empty as in
.txt=
? I know highlight.js has anohighlight
CSS class but that would require a CSStxt
extension attribute selector hack.@Uncled1023 Maybe my guess was right. According to Unknwon, Gog's dev, there's probably a way to disable highlighting for the
.txt
extension, using highlightjs built-innohighlight
class in Gog'sapp.ini
.What do you think about it?
EDIT: BTW, they didn't fix it only for
LICENSE
files. Specific filenames can be ignored by highlighting.Huh interesting. I can test it out to see if it works. I think it will as Unknwon said.
OK, let me know the outcome.
Somewhat fixed in
develop
branch. Closing.@Uncled1023
Since you switched to Gitea, can you try adding to
app.ini
to see if syntax highlighting is disabled on plain text files?
Alright, thanks. Let me see how it works.
Ok, should be working now.
Finally. Thanks, plain text files look better now. Closing.