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
Drop support for pygments as syntax-highlighter #6983
Conversation
lib/jekyll/tags/highlight.rb
Outdated
highlighted_code.sub('<div class="highlight"><pre>', "").sub("</pre></div>", "") | ||
def render_pygments(code, _is_safe) | ||
Jekyll.logger.warn "Warning:", | ||
"Highlight Tag no longer supports rendering with Pygments" |
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.
This is a pretty clever idea 💡👍🏼
👍And do u forget the |
@crispgm Ah yes, I did..!! Thanks 👍 |
Our docs should reflect that change https://jekyllrb.com/docs/templates/#code-snippet-highlighting |
I left that out intentionally since our docs are not versioned.. I believe that a |
@ashmaroli right, it was more of a reminder. Maybe we could keep a list of changes to make to the docs before the release instead? |
Yes. Exactly what I was thinking..
|
Maybe it would be best if we didn't work on 4.0 on Or, we could create a new branch for the live site. GitHub Pages would build from that branch, and |
I feel like I've encountered a stalemate..
Now that we've started working on
This is an additional overhead for us to maintain a temporary site source on the |
I worry that having a bunch of open docs PRs that must be kept up-to-date with code changes and that must be kept relatively free of merge conflicts and that cannot be merged until the day 4.0 launches would be far more overhead. |
True.. true.. true.. |
lib/jekyll/tags/highlight.rb
Outdated
|
||
highlighted_code.sub('<div class="highlight"><pre>', "").sub("</pre></div>", "") | ||
def render_pygments(code, _context) | ||
Jekyll.logger.warn "Warning:", |
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.
This should probably fail the build, right?
Otherwise, folks who use (ie) GitHub Pages will just stop having syntax highlighting in their code with no clue as to why, and that is if they notice.
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.
yeah.. that's true..
I'd prefer users to keep abreast with changes in a major version and check for any warnings in their terminal output instead of getting a Page Build Error email from GitHub Pages..
but that's just me..
People just don't have the time to do a local run first.. 🙂
I'll update it to raise
instead
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.
@pathawks Or... should we silently fallback to highlighting with Rouge
? 💡
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.
@ashmaroli if there is no compatibility issue between the two highlighters, this could be the nicest solution for all users.
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.
From the README at jneen/rouge
:
Its HTML output is compatible with stylesheets designed for pygments.
If there's still a need for using pygments
explicitly, the community can build a plugin which will be able to easily hook into the render
method here.
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.
Rouge::Formatters::HTMLPygments.new(formatter, css_class='codehilite')
wraps the given formatter with div wrappers generally expected by stylesheets designed for Pygments
Where are the changes to documentation? How did we decide to handle that? |
We could hide 4.0-specific doc changes behind a flag that we enable once the release has been done? I'm also not too into the idea of keeping a whole separate branch or lots of open PRs. |
@oe Such a flag doesn't currently exist.
/cc @DirtyF what say? |
This PR seems to gathered a lot of noise. I'm going to close this in favor of a new one. |
Resolves #6823
e.g. The plugin would just have to override
HighlightBlock::render_pygments
to provide the functionality.