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 is done on plain text LICENSE files #2181

Closed
yurivict opened this issue Dec 13, 2015 · 9 comments
Closed

Syntax highlighting is done on plain text LICENSE files #2181

yurivict opened this issue Dec 13, 2015 · 9 comments
Labels
🔨 enhancement Make it better, faster
Milestone

Comments

@yurivict
Copy link

For example, this file when migrated into Gogs is highlighted:

https://github.com/yurivict/node-line-tracer/blob/master/LICENSE

@unknwon unknwon added the 🔨 enhancement Make it better, faster label Dec 13, 2015
@unknwon unknwon added this to the 0.9.0 milestone Dec 13, 2015
@linquize
Copy link
Contributor

gogs mis-treat it as something like shell script?

@yurivict
Copy link
Author

yes

@unknwon
Copy link
Member

unknwon commented Dec 17, 2015

Fixed in develop branch. See in action: https://try.gogs.io/gogs/gogs/src/develop/LICENSE

@ghost
Copy link

ghost commented Oct 31, 2016

Any special reason to fix incorrect highlighting only on LICENSE files? This can't be right.
All files using the standard .txt extension or files without an extension (usually in all caps, but not necessarily) like README, CHANGELOG, LICENSE, HISTORY, meta, todo etc., should not be highlighted because they're readable plain text.

Some examples below.

LICENSE - Not an actual LICENSE file, just renamed that way so no highlighting occurs
LICENSE2 - A number added to LICENSE automatically highlights the text
LICENSE.txt - the standard txt extension automatically highlights the text

@ghost
Copy link

ghost commented Nov 4, 2016

@unknwon Should I create a new issue?

@ghost ghost mentioned this issue Nov 7, 2016
7 tasks
@unknwon
Copy link
Member

unknwon commented Dec 21, 2016

@MEGADR01D

Any special reason to fix incorrect highlighting only on LICENSE files?

https://github.com/gogits/gogs/blob/master/modules/template/highlight/highlight.go#L16

@ghost
Copy link

ghost commented Dec 21, 2016

@unknwon I see. But what about any file with a .txt extension getting highlighted? highlightExts is not including .txt.

Does .txt have to be explicitly added in highlightMapping?

@unknwon
Copy link
Member

unknwon commented Dec 21, 2016

@MEGADR01D there is no perfect solution for highlighting, but I think in your case add following content to your app.ini should disable highlighting for .txt files:

[highlight.mapping]
.txt= nohighlight

@ghost
Copy link

ghost commented Dec 21, 2016

@unknwon Since I'm using a 3rd party hosted Gogs, let me get back to you, on this, before I close this and the other issue I created. I thought it was a bug within Gogs but I see it's normal behavior of highlightjs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🔨 enhancement Make it better, faster
Projects
None yet
Development

No branches or pull requests

3 participants