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
Refactor highlighter to allow for configuration #2590
Conversation
…id tags and RedCarpet markdown
Hey! Thanks for the pull request. Always great to see new avatars around 👊
I'm not sure I entirely understand the motivations behind this nor agree with those I can infer. Would you care to expand on your reasoning behind this? /cc @benbalter, the configuration 🎄 cop. |
@parkr What I meant by this was that you can provide default configuration values that will be passed to Currently, there is no way to override these options when using RedCarpet's When using the Liquid HighlightBlock, it is possible to override these options, so that, in the case provided above, all codeblocks will be assigned line numbers and can then be disabled individually. An example of this would be the following, in which the first code block will not have line numbers, while the rest will: _config.yml
index.md
|
@hexid Does the refactoring tackle this issue rouge-ruby/rouge#118 too? |
@penibelst I was able to add support for both Pygments and Rouge while using Kramdown @parkr Should I include these changes in this PR or prep another with those changes? |
👏 👏 👏 |
My only concern would be the Makefile hack that we had to add in the redcarpet plugin. I'm not sure if Kramdown has the same behavior, but redcarpet turns all leading tabs into 4 spaces, which completely breaks Makefile syntax. So if that happens (i.e. |
@jneen not necessarily |
@parkr was this fixed? |
No. Having read through the comments again, I'm not convinced it's worth the trouble/maintenance costs/configuration overhead. |
No worries. It turns out the makefile hack isn't necessary in Kramdown anyways, and they have rouge support now. |
Ok cool. What version added that in? We doing the right things to make this available? |
I'm not sure... let me dig it up |
I have been working on adding highlighter settings to
_config.yml
for the past few days. So far I have been able to set default configurations for both Liquid and RedCarpet highlight blocks.Currently, I am using the following structure in my
_config.yml
file to add inline line numbers to all highlight blocks:All of the following are affected by the prior configuration (assuming RedCarpet as the markdown engine for the first two):
This, however, is not limited to the
linenos
options and can also be used with other options that affect the highlight tag, such ashl_lines
andlinenostart
. Granted, this is assuming that you are usingpygments
as your highlighter.If anyone could chime in about the below points, along with any concerns you might have, that would be greatly appreciated.
lib/jekyll/highlighter.rb