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

add HTMLLineanchors formatter #897

Open
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
2 participants
@m-cat
Copy link

commented Apr 19, 2018

  • also add lineanchors and linewise options to HTMLLegacy

Since Rouge is the default highlighter in Jekyll, I wanted to add the option to use lineanchors for improved compatibility with another popular syntax highlighter (and the previous default in Jekyll), Pygments. It looks like there was no existing formatter I could use -- I wanted an anchor before each line, but linewise wraps the entire line in a div.

This formatter is not very useful apart from compatibility, because line anchors don't really belong in code blocks. If you have more than one code block, then an anchor like "line-1" is ambiguous, and kind of useless. Still, people on the internet seem to use it.

I added a lineanchors option to the HTMLLegacy formatter, which is the default in Jekyll. I also added a linewise option to use the existing HTMLLinewise formatter, which I think is better. If this goes through, I'll be raising a separate PR in the Jekyll repo to enable these options.

add HTMLLineanchors formatter
also add `lineanchors` and `linewise` options to HTMLLegacy
@m-cat

This comment has been minimized.

Copy link
Author

commented Jan 19, 2019

Doth my eyes deceive me...? Has a mortal soul at long last glimpsed this PR?

Here's some more context: my blog post, Jekyll plugin that implements this.

@pyrmont

This comment has been minimized.

Copy link

commented May 17, 2019

I'm sorry there hasn't been much movement on this since it was submitted. There's renewed work being done on looking at outstanding PRs and hopefully the backlog will start being cleared soon.

I'm trying to help look through things and had a couple of questions:

  1. Does it makes sense to allow the HTMLLineanchors formatter to be referenced from the HTMLLegacy formatter? Per the README:

    Rouge::Formatters::HTMLLegacy.new(opts={}) is a backwards-compatibility class intended for users of rouge 1.x, with options that were supported then.

    It seems to me that a formatter that's being added in version 3 isn't something that users of Rouge 1.x would expect to be available.

  2. Since this PR was submitted, #1085 has been submitted. There's been discussion in that PR about allowing for the HTML tag to be configurable (as is the case in #1090). If that were implemented, would that obviate the need for this PR?

@m-cat

This comment has been minimized.

Copy link
Author

commented May 17, 2019

Hey Michael! Thanks for taking a look. Glad the project is moving forward! I'll get back to your questions in a couple of days, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.