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

bump rouge to 2.0.x #5230

Closed
wants to merge 1 commit into from
Closed

bump rouge to 2.0.x #5230

wants to merge 1 commit into from

Conversation

Crunch09
Copy link
Member

Hi,

this bumps rouge to 2.0.x as discussed in #4891 (comment) .

I used the HTMLLegacy formatter to avoid breaking changes but there are some minor ones as you can see in the tests (no text-align: right; on the td of the line number for example). If this is not okay, i think we would have to write our own formatter.

@@ -34,7 +34,7 @@ Gem::Specification.new do |s|
s.add_runtime_dependency('mercenary', '~> 0.3.3')
s.add_runtime_dependency('safe_yaml', '~> 1.0')
s.add_runtime_dependency('colorator', '~> 1.0')
s.add_runtime_dependency('rouge', '~> 1.7')
s.add_runtime_dependency('rouge', '~> 2.0.5')
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure here if we should choose ~> 2.0.5 or ~> 2.0

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s.add_runtime_dependency(">= 1.7", "< 3") == "1.x", "2.x"

@envygeeks
Copy link
Contributor

I'm sorry but this pull in it's current form is unacceptable for 3.x. You _must_ allow 1.x (Rouge) to remain and work around Rouges changes in order for this to be accepted in 3.x as it's a breaking change that affects people, plugins and other stuff. This is what I had tried to imply was the problem on talk.jekyllrb.com, it's just too much work, without a wrapper of which we should have built long ago.

@envygeeks
Copy link
Contributor

Either way, if you are willing to fix the problem so that both 1.x and 2.x work then it can be accepted in 3.x but until then it has a 👎 from me, because I do not wish to deal with upgrading the hundreds of plugins we have on our own sites that use Rouge 1.x in some way before absolutely necessary and even if I do, I do not wish to have to do it overnight because Jekyll decided to randomly upgrade a major dependency.

@parkr
Copy link
Member

parkr commented Aug 11, 2016

@envygeeks Point taken – I proposed we do this for 3.3 after it was shot down for 3.2 due to timing (#4891 (comment)). I'm 👍 on doing this if it's backwards-compatible. Could we check Rouge::VERSION?

@parkr parkr added this to the undetermined milestone Aug 11, 2016
@Crunch09
Copy link
Member Author

Thanks for the feedback! Will try to make it work with rouge 1.x

@Crunch09
Copy link
Member Author

Making some good progress on this!
But i am not sure which Formatter we should choose for 2.x ? I guess we don't need to use the Rouge::Formatters::HTMLLegacy formatter because users who want this behaviour are still free to use Rouge ~> 1.7.

%(</tr></tbody></table></code></pre></figure>\n\n) +
%(<p>This should not be highlighted, right?</p>),
@result
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was much easier to read before. Is there a reason this needed to be changed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only reason here was to be consistent with the test on line 318.

@crispgm crispgm mentioned this pull request Nov 7, 2016
@pathawks
Copy link
Member

pathawks commented Nov 7, 2016

Fixes #5556

@jneen
Copy link

jneen commented Nov 7, 2016

Hi! What I recommend doing is actually defining your own formatter, especially if there are special things you want it to do. You can look through the existing formatters as well as the Gitlab Formatter. Alternately, you can use Formatters::HTML to generate plain unadorned HTML and add stuff around it as you like. Looking at the code you have, you might also consider using Formatters::HTMLTable, which takes an inner formatter (Formatters::HTML in your case) and a number of line numbering options.

@jneen
Copy link

jneen commented Nov 7, 2016

Ah yes, and if you want to support both 1.x and 2.x, you'll have to define a wrapper, as the APIs are different.

@Crunch09
Copy link
Member Author

Crunch09 commented Nov 7, 2016

@jneen Thank you!

@fliiiix
Copy link

fliiiix commented Nov 26, 2016

@Crunch09 are you working on it?

@Crunch09
Copy link
Member Author

@fliiiix Yes. Sorry for the delay, it's been a busy couple of weeks but there should be an update by the end of the weekend.

@Crunch09
Copy link
Member Author

@jekyll/core Unfortunately i still have some open questions regarding this and i hope you can help to clear them up so i can push an update:

  • If we write our own formatter, should it produce the exact same output as now with Rouge 1.7? If not, what should / is allowed to change compared to the current version? I guess if we were to change some things this wouldn't be a breaking change for users as they still could use the old Rouge version.
  • If we want to land this in jekyll 3.4 and support both Rouge versions should there be different CI builds to test against each version?

@parkr
Copy link
Member

parkr commented Jan 16, 2017

Fixes #5774.

@willclarktech
Copy link

Hi, is there any movement on this? Currently code highlighting of ES6 template literals are broken on GitHub Pages sites because rouge 1.x doesn’t support them.

@pathawks
Copy link
Member

If we write our own formatter, should it produce the exact same output as now with Rouge 1.7? If not, what should / is allowed to change compared to the current version? I guess if we were to change some things this wouldn't be a breaking change for users as they still could use the old Rouge version.

If a user has Rouge 1.x installed, the output should be unchanged. If a user has Rouge 2.x installed, they should be aware that the output might be different.

If we want to land this in jekyll 3.4 and support both Rouge versions should there be different CI builds to test against each version?

I don't think we need to double the size of our matrix, but we should have at least one that tests with the old Rouge and at least one that tests with the new. Probably only have one that tests against Rouge 1.x and move everything else to 2.x?

@Crunch09
Copy link
Member Author

@pathawks Thank you for the clarification, that should help!

@guymorita
Copy link

Can we get this merged in? Would help lots. Thanks.

@jekyllbot jekyllbot added the has-pull-request Somebody suggested a solution to fix this issue label Jun 18, 2017
@DirtyF DirtyF modified the milestones: 3.5, 3.6 Jun 18, 2017
@Crunch09
Copy link
Member Author

@guymorita Hi, please see #6150 for updates.

@Crunch09 Crunch09 closed this Jun 18, 2017
@jekyll jekyll locked and limited conversation to collaborators Jul 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
frozen-due-to-age has-pull-request Somebody suggested a solution to fix this issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants