-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Server-side syntax highlighting for all code #12047
Conversation
This PR does a few things: * Remove all traces of highlight.js * Use chroma library to provide fast syntax hilighting directly on the server * Provide syntax hilighting for diffs * Re-style both unified and split diffs views * Add custom syntax hilighting styling for both regular and arc-green Fixes go-gitea#7729 Fixes go-gitea#10157 Fixes go-gitea#11825 Fixes go-gitea#7728 Fixes go-gitea#3872 Fixes go-gitea#3682 And perhaps gets closer to go-gitea#9553
I think you still need to run |
Thanks! fixed |
Oh, and |
fixed |
@silverwind made a few tweaks to light theme based on the link you gave above -- think it is pretty good for now. Pygments doesn't have quite the level of detail that pretty lights does in some areas but is pretty close. Also raised the threshold for highlighting to 1MB based on https://help.github.com/en/github/creating-cloning-and-archiving-repositories/limits-for-viewing-content-and-diffs-in-a-repository |
Run |
Syntax looks good on light and dark. I have not encountered some of the more exotic identifiers in the files I was looking at but we should be good with those brighter color on arc-green. |
🚀 |
Thanks all : ) |
Fix regression casued by go-gitea#12047 so copy/paste works properly in all browsers. Fixes go-gitea#12184 Also while looking at this I saw a small display issue for blame view. I think go-gitea#12023 was merged into original PR through an update branch before go-gitea#12047 was merged and made one of the css ruules not apply anymore.
* Make copy/paste work for source code Fix regression casued by #12047 so copy/paste works properly in all browsers. Fixes #12184 Also while looking at this I saw a small display issue for blame view. I think #12023 was merged into original PR through an update branch before #12047 was merged and made one of the css ruules not apply anymore. * use pseudo-element to prevent copying of comment + symbol even when not visually selected * remove added newline here should not be necessary anymore * make sure empty line is newline so there is something to select and copy
* Server-side syntax hilighting for all code This PR does a few things: * Remove all traces of highlight.js * Use chroma library to provide fast syntax hilighting directly on the server * Provide syntax hilighting for diffs * Re-style both unified and split diffs views * Add custom syntax hilighting styling for both regular and arc-green Fixes go-gitea#7729 Fixes go-gitea#10157 Fixes go-gitea#11825 Fixes go-gitea#7728 Fixes go-gitea#3872 Fixes go-gitea#3682 And perhaps gets closer to go-gitea#9553 * fix line marker * fix repo search * Fix single line select * properly load settings * npm uninstall highlight.js * review suggestion * code review * forgot to call function * fix test * Apply suggestions from code review suggestions from @silverwind thanks Co-authored-by: silverwind <[email protected]> * code review * copy/paste error * Use const for highlight size limit * Update web_src/less/_repository.less Co-authored-by: Lauris BH <[email protected]> * update size limit to 1MB and other styling tweaks * fix highlighting for certain diff sections * fix test * add worker back as suggested Co-authored-by: silverwind <[email protected]> Co-authored-by: Lauris BH <[email protected]>
This PR does a few things:
Fixes #7729
Fixes #10157
Fixes #11825
Fixes #7728
Fixes #3872
Fixes #3682
And perhaps gets closer to #9553
Suggestions welcome for styling
New Diff: