-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Replace highlight.js with rouge-fork rugments #8425
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
Conversation
|
I've prepared a stage. Click to open. |
|
Cool. Anyone else willing to help with this PR? I would like too but I am busy this week. |
app/helpers/blob_helper.rb
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep in mind that this can throw Rouge::Lexer::AmbiguousGuess in some edge cases. It's unlikely since you've passed both the filename and the source (and if it does it's likely I'll consider it a bug in rouge), but it's something you may want to handle and report.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can also call Rouge::Lexer.guesses with the same arguments and it will return a list (possibly empty) of lexer classes, so you could pick one and default to Rouge::Lexers::Text.
|
👍 awesome! Let me know if you have any questions about rouge, I'm happy to help. |
|
@rumpelsepp Are there certain places you need help with? |
|
I had a surgery in hospital this week. So unfortunately this pull request will take some more time as I want to fully recover first... But to answer your question a few thoughts:
Without looking at my code these are the major problems I remember. Sorry for the delay... :) |
|
Ok! No problem, hope it was not something serious? Have a good recovery! On Sat, Dec 13, 2014 at 11:03 PM, Stefan Tatschner
|
|
You should be able to make an |
No, nothing life-threatening. :) Thanks!
As a single line is not wrapped with an html tag with an |
lib/redcarpet/render/gitlab_html.rb
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line is too long. [82/80]
Use the new Ruby 1.9 hash syntax.
|
@rumpelsepp Awesome! |
|
thx. :) |
|
Nice! 🍰 |
|
:) |
|
If you mean pull-request, just one is good in this case, its a major change, so better to have that in one single PR. If you mean squashing the commits, just keep working on this the way you like it. At the end i'll review it and then decide if its better to squash or leave it like this :) |
|
So. The this pull request should be pretty much complete. There is only one issue left with Rouge's HTML formatter as it is not able to wrap lines with something like Everything else is ready for testing! |
|
I don't have time to work on it right now, but I'd be happy to review a design and PR for it. |
|
@rumpelsepp Thanks for your work on this :) Can you please make sure the tests are passing? |
I have already made sure that all possible tests are passing. These last tests are failing because of the missing line anchors I explained above. So when we are able to make this work again the tests should pass. |
|
@rumpelsepp Ok, missed that part :) Thanks for explaining! |
|
I have chosen a better white and dark theme. You can check out this pull request on my private gitlab instance. If you want to see another theme you can e.g. change the css class in your browser inspector. The CSS classes for the available themes are: |
|
@rumpelsepp I like the dark theme :) Feels a bit like my vim environment :) |
|
It looks really good |
|
You did good job with this PR. I really would like to merge this one but we need to fix |
|
Thank you. :) So I think here is some work left... :( |
|
Please ping me when you get tests green so we can merge it :) |
I did this commit in an earlier revision of my pull request. As reverting this commit later caused failing tests I decided to include it again.
I decided to create a fork of rouge as rouge lacks a HTML formatter with the required options such as wrapping a line with <span> tags. Furthermore I was not really convinced about the clarity of rouge's source code. Rugments 1.0.0beta3 for now only includes some basic linting and a new HTML formatter. Everything else should behave the same.
|
The tests pass on my machine and the pull request should be complete for now. I have edited the commit messages and rebased on master. As explained in the commit messages I have created a fork of rouge (rugments) 'cause there are problems with the html formatter. When I release the next version of rugments I will open another pull request which cleans up a bit more stuff. But for now I am quite happy with the results. If there are any further problems please let me know! What's the matter with semaphoreci? I just edited the commit description and now my tests fail somewhere else? |
|
Very reliable; retriggered the tests, now it's green! |
|
@rumpelsepp thank you a lot. I wlll merge it after release! |
|
Looks like Semaphore starts new build on every PR change (assignee, label etc) Looks like a bug to me |
|
@randx Yes they have. I already reported that issue. They are aware of that. |
Replace highlight.js with rouge-fork rugments
|
@rumpelsepp Thank you for such huge work done! |
|
:) |
|
Hey @rumpelsepp I just became aware of your fork - do you wanna talk about merging some of that work upstream? |
|
The HTML formatter is a bit of a mess right now. We're open for suggestions - it's under a lot of pressure to be a lot of different things, so it'll likely be split into several formatters. Additionally, it'd be pretty easy to create a formatter without a fork. Just subclass |
|
@jneen Yeah, I absolutely want to merge some of my work back -- when it's ready. I want to play around a bit (it's really great for improving my ruby skills!) and I introduced a few backwards breaking changes (the master branch is quite broken at the moment). So I thought it would be much simpler to do this stuff on my own git tree first rather than wasting your time with reviewing broken stuff. :) |
|
ok cool :) |
|
Any news on this? Is this in the latest CE edition? |
|
Question: @kfuglsang created a new C/AL language formatter in highlight.js which we thought will eventually come to gitlab. Where do we need to send a pull request to get such a highlighter in? |
|
@forki highlight.js is not used anymore in Gitlab since this pull request was merged. If you need a C/AL language formatter in Gitlab, see if you can get it in rouge and/or rugments, and get it then updated in Gitlab. |
|
Thanks. Could you please point me in the right direction? I'm looking for a
|
|
Unfortuntately rouge doesn't have pascal or delphi support right now, but i'd merge a new lexer in a heartbeat! |
|
Ok now I know why syntax highlighting stopped working for us ;-)
|
|
Rouge also has a lexer subclassing thing which makes it pretty easy to maintain similar lexers (C/C++/Objective C, Javascript/QML/ActionScript) |









A few day ago I have opened this issue here #8404. I am neither a ruby nor a rails pro but I have managed to create some kind of demo. It is not ready for merge. You could consider it as a proof of concept and for comparing the results between
highlight.jsandrougeAgain some explanations
pygmentshandles this very well but it is a python libraryrougeis a highlighter in ruby which is compatible to pygments themes. It is able to do this kind of guessing, too.TODO
Demo
Checkout my private Gitlab instance. I have included this pull request there already:
https://gitlab.sevenbyte.org/u/stefan
Instructions for changing the theme without an account are here: #8425 (comment)