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

Specific Code Line Highlighting #617

Closed
aalvrz opened this issue Jan 24, 2017 · 16 comments
Closed

Specific Code Line Highlighting #617

aalvrz opened this issue Jan 24, 2017 · 16 comments
Labels
enhancement-request A request for an enhancement to be developed. stale-issue There has been no activity for a year.

Comments

@aalvrz
Copy link
Contributor

aalvrz commented Jan 24, 2017

I wanted to know if it's possible to highlight specific lines of code? For example:

def add(a,b)
  c = a + b
  puts c # I want to highlight this line
end

NOTE: By highlight I do not mean syntax highlighting, but rather line highlighting (some applying of background color to the specified line in the code block).

@revathskumar
Copy link

In this case I tried to use Diff highlighting, but AFAIK by default rouge doesn't support missing of syntax highlighting of diff and other language. I raised a issue #642 related to this.

Later as my friend suggested, wrote a custom lexer by extending the JSON lexer and prepended the Diff lexer rules, I was able to make it work. See the issue #642 for code example.

Also here is my example workaround

@aalvrz
Copy link
Contributor Author

aalvrz commented Mar 29, 2017

@revathskumar That issue seems to be similar to what I am trying to achieve, except I am not concerned with diffs. I just want Rouge to somehow be able to identify some characters that indicate the highlighting of a specific line in a code block (used in Markdown with Redcarpet).

I am guessing this must be added to the main lexer (or something like that). I could try working on it for a PR but some help would be appreciated.

@jneen
Copy link
Member

jneen commented Jun 5, 2017

I have a spec I'm working on for some kind of "HLML" markup to allow arbitrary combinations of highlighters and custom tokens, which I think is what would be needed here. However, I don't have the bandwidth to work on it any time soon - but I would be happy to pass of a sketch of it if one of yall wanted to take it on.

@aalvrz
Copy link
Contributor Author

aalvrz commented Jun 6, 2017

@jneen That would be great. I would like giving it a try.

@aalvrz
Copy link
Contributor Author

aalvrz commented Jun 15, 2017

@jneen Any updates on this?

@aalvrz
Copy link
Contributor Author

aalvrz commented Jul 25, 2017

@gfx @dblessing

Any updates on this?

@MischaDeNola
Copy link

MischaDeNola commented Sep 26, 2017

Moved to: #790

@jneen
Copy link
Member

jneen commented Sep 27, 2017

@MischaDeNola happy to help, but could you move this to a different issue?

@MischaDeNola
Copy link

Done.

@stale
Copy link

stale bot commented Jun 19, 2019

This contribution has been automatically marked as stale because it has not had any activity for more than a year. It will be closed if no additional activity occurs within the next 14 days.

@stale stale bot added the stale-issue There has been no activity for a year. label Jun 19, 2019
@pyrmont
Copy link
Contributor

pyrmont commented Jun 19, 2019

Hi everyone :) @jneen added a special escape lexer recently that I think might allow this using HTML. I'd suggest checking that out :)

@stale stale bot removed the stale-issue There has been no activity for a year. label Jun 19, 2019
@pyrmont pyrmont added the enhancement-request A request for an enhancement to be developed. label Jun 19, 2019
@stale
Copy link

stale bot commented Jun 18, 2020

This issue has been automatically marked as stale because it has not had any activity for more than a year. It will be closed if no additional activity occurs within the next 14 days.
If you would like this issue to remain open, please reply and let us know if the issue is still reproducible.

@stale stale bot added the stale-issue There has been no activity for a year. label Jun 18, 2020
@pyrmont
Copy link
Contributor

pyrmont commented Jun 19, 2020

After thinking about this again, I don't think the escape lexer does solve the issue. I'll add it back to the pile. Apologies for the delay :(

@stale stale bot removed the stale-issue There has been no activity for a year. label Jun 19, 2020
@stale
Copy link

stale bot commented Jun 20, 2021

This issue has been automatically marked as stale because it has not had any activity for more than a year. It will be closed if no additional activity occurs within the next 14 days.
If you would like this issue to remain open, please reply and let us know if the issue is still reproducible.

@stale stale bot added the stale-issue There has been no activity for a year. label Jun 20, 2021
@stale stale bot closed this as completed Jul 8, 2021
@ernstki
Copy link

ernstki commented Aug 14, 2021

I hope stalebot doesn't re-open this on my account (I dunno how that works), but (Edit: nope) it looks like this was implemented in #264, right?

@woodjosj
Copy link

woodjosj commented Aug 14, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement-request A request for an enhancement to be developed. stale-issue There has been no activity for a year.
Projects
None yet
Development

No branches or pull requests

7 participants