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
[WIP] Add shim that works for both Rouge 1 and Rouge 2 #5919
Conversation
I made some quick testing: Given I upgrade Jekyll's repository to rouge 2.0.7 |
Hey 👋 the main issue i encountered when working on #5230 was that it didn't seem possible to rebuilt the exact same output we had when using Rouge 1.7 and i was also not sure we even want to have the same exact output, that's why i couldn't continue (#5230 (comment)). In my opinion it would be best to have the input of some users who actually want to use the new features of Rouge 2 with Jekyll and then decide on a custom formatter (based on a provided formatter from Rouge v2 as @jneen suggested). @parkr Still happy to help if you need any form of support on implementing this |
Thanks! So it sounds like all people want from Rouge v2 are the extra formatters – the Ruby API doesn't really matter. The reason we can't upgrade is that some people have written their own formatters so we can't block them from using Rouge 1. I wonder: if they're writing their own formatters or monkey-patching Jekyll to modify how it uses Rouge, then maybe we can get away with allowing Rouge 1 & 2 in the gemspec, upgrading to Rouge 2 in our code? @envygeeks I seem to remember you mentioning that you'd done some customization with Rouge. Can you help us understand what changes we can make to allow Rouge 2 that wouldn't affect you? If you're monkey-patching, for example, then we could just change the methods you have money-patched and be totally in the clear as long as our gemspec allows either version. |
We are currently developing a lexer as a contribution to Rouge, which we'd like to then use automatically on github pages, HOWEVER - it appears that this development will be in vain unless this pull request is merged. What are the blockers? |
@allanbowe Hey, you can see the main issues mentioned in the posts above. Seeing as we don't make progress with this as it is right now, i'd propose we settle for one custom formatter (while still supporting Rouge 1) and allow users to use their own formatter. Based on hopefully more feedback once this is out we can then improve the new formatter. |
Hi! This has gone on for a really long time. Rouge 2.0 was released a year ago, and 1.x is no longer supported. I'm getting issues opened on Rouge about bugs that were fixed ages ago because Jekyll is still on an ancient version :\ |
@Crunch09 It is possible to write a wrapper class that uses either |
Also, I'm not clear on the incompatibility story for users who wrote their own formatters - if they wrote their own, how are they affected by the existing ones changing? |
@jneen Thank you for your reply! I'm not a maintainer for Jekyll though, so i think it would be best if @parkr could maybe list what needs to be done before we can release it? |
I think the best approach is to use |
#6150 supersedes this. |
#6150 points to this PR. |
* use `Rouge::Formatters::HTMLLegacy` and fix tests * set default rouge version to 2.1.0 * allow more than just 2.1.x versions by default
@DirtyF It shouldn't, that's one of the reasons why we're using the |
@Crunch09 I have a hard time understanding why |
My understanding is that HTMLLegacy simply provides the same Ruby API, but it uses the new HTML-based formatters internally. |
@DirtyF I think @parkr is right. From the rouge readme:
If users want to be sure there are absolutely zero breaking changes in their site they can (according to this PR) still use the old rouge version with upcoming minor versions of jekyll. |
I'm still concerned about this ☝️ |
I don't really understand what this has to do with Rouge; isn't that stuff added on our end anyway? |
@pathawks I didn't know that! |
Could you please try it again with rouge 2.1.1 @DirtyF which has been released today? It seems to have fixed the issue for me locally. |
@Crunch09 tested this branch on two different websites (jekyll docs and one of mine) and still no |
@DirtyF Odd that the test is passing, but it isn't working for you. |
@DirtyF Sorry, my mistake. Ran it without |
yeah maybe we don't have the proper rendering tests here? |
@DirtyF Found the issue. (This time hopefully for real 🙄 ) Support for Rouge 2 has been added but is yet to be released.
Produces in Rouge 1.11 with the current kramdown release 1.13.2: <div class="language-liquid highlighter-rouge"><pre class="highlight"><code>
<span class="p">{{ </span><!-- ... --> %}</span>
</code></pre>
</div> Produces in Rouge 2.10 with the current kramdown release 1.13.2 (as noted by DirtyF): <div class="language-liquid highlighter-rouge">
<span class="p">{{ </span><!-- ... --> %}</span>
</div> Produces in Rouge 2.10 with the unreleased kramdown version (current master): <div class="language-liquid highlighter-rouge"><div class="highlight"><pre class="highlight"><code>
<span class="p">{{ </span><!-- ... --> %}</span>
</code></pre></div></div> The last code block adds an additional To try it out locally (with jekyll docs):
I could submit a failing PR for this behavior but not sure it'll be worth it as it'll only pass once a new kramdown version has been released. |
Asked now if we could have a new kramdown release: gettalong/kramdown#439 |
I could have sworn that at one point we were overriding kramdown's built-in highlighting so that it would be as if the user had used the |
I don't know what the release plan for jekyll is but given that 3.5.1 has been released and this is in the 3.6 milestone and all tests are passing, would it make sense to merge this into master? |
This is the main drive for v3.6.0. I've branched off a @jekyllbot: merge +minor |
This PR aims to allow Rouge v1 or v2 to be used with Jekyll. This will allow users to choose to stay on the old version or to upgrade if possible/they want to.
In #5230, we learned from @jneen that we cannot rely on the same classes if folks want to upgrade to Rouge 2.
I have attempted to create a helper utility which creates the necessary Rouge formatter that we need to process our files.
While this is still a work in progress, I would appreciate any general opinions on the API design. I think I may have misinterpreted @jneen's comments in #5230.
/cc https://github.com/github/pages/issues/1359