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 support for the Rouge syntax highlighter #247

Closed
mojavelinux opened this issue Jun 27, 2015 · 7 comments
Closed

Add support for the Rouge syntax highlighter #247

mojavelinux opened this issue Jun 27, 2015 · 7 comments
Assignees

Comments

@mojavelinux
Copy link
Member

Allow the use of the Rouge syntax highlighter by setting the value of the source-highlighter attribute to rouge.

@mojavelinux mojavelinux self-assigned this Jun 27, 2015
@mojavelinux mojavelinux added this to the v1.5.0 milestone Jun 27, 2015
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Jun 27, 2015
- add integration with rouge
- organize the code to setup syntax highlighting
- don't crash if color value is 3-digit hex in span style
@mojavelinux
Copy link
Member Author

Before merging, I'd like to implement a Prawn formatter that creates text fragments directly to avoid having to parse the generated HTML. This is similar to what we've done for CodeRay.

@mojavelinux
Copy link
Member Author

And once that is done, I think we should just drop support for Coderay and map the "coderay" source highlighter value to Rouge.

mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Jun 28, 2015
- add integration with Rouge
- organize the code to setup syntax highlighting
- enable line number support when highlighting with Rouge
- add pastie theme for Rouge
- patch Rouge style lookup (see rouge-ruby/rouge#280)
- don't crash if color value is 3-digit hex in span style
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Jun 28, 2015
- add integration with Rouge for highlighting source listings
- organize the code to setup source highlighting
- enable line number support when highlighting with Rouge
- add pastie theme for Rouge
- patch Rouge style lookup (see rouge-ruby/rouge#280)
@mojavelinux
Copy link
Member Author

Prawn formatter implemented. I also implemented support for line numbers (with primitive, but sufficient, output).

mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Jun 28, 2015
- add integration with Rouge for highlighting source listings
- organize the code to setup source highlighting
- enable line number support when highlighting with Rouge
- add pastie theme for Rouge
- patch Rouge style lookup (see rouge-ruby/rouge#280)
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Jun 28, 2015
- add integration with Rouge for highlighting source listings
- organize the code to setup source highlighting
- enable line number support when highlighting with Rouge
- add pastie theme for Rouge
- patch Rouge style lookup (see rouge-ruby/rouge#280)
@mojavelinux
Copy link
Member Author

All that's really left to do is allow the start number to be customized when line numbers are enabled.

@mojavelinux
Copy link
Member Author

We have to add a trailing endline or else certain highlighting rules don't take affect on the last line. (See rouge-ruby/rouge#279). Although this endline is benign in Prawn, we could strip it out before applying the formatting using the following code:

tokens = tokens.entries
if (last_token = tokens_a[-1])
  if (last_val = last_token[-1]) == EOL
    tokens.pop
  else
    last_token[-1] = last_val.chomp
  end
end

mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Jun 28, 2015
- add integration with Rouge for highlighting source listings
- organize the code to setup source highlighting
- enable line number support when highlighting with Rouge
- add pastie theme for Rouge
- patch Rouge style lookup (see rouge-ruby/rouge#280)
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Jun 28, 2015
- add integration with Rouge for highlighting source listings
- organize the code to setup source highlighting
- enable line number support when highlighting with Rouge
- add pastie theme for Rouge
- patch Rouge style lookup (see rouge-ruby/rouge#280)
@rlopez133
Copy link

👍 on Rogue highlighter

@mojavelinux
Copy link
Member Author

I'd like to do some side-by-side comparison of real-world code snippets to see how good a job Rouge does vs CodeRay and Pygments. I've got a bunch of repositories cloned, so I'll do a quick scan and see what comes up. If you're following this issue, free to test on any snippets you have to see if any deficiency come up in Rouge.

mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Jul 6, 2015
- add integration with Rouge for highlighting source listings
- guard indentation within Rouge formatter
- organize the code to setup source highlighting
- enable line number support when highlighting with Rouge
- add pastie theme for Rouge
- patch Rouge style lookup (see rouge-ruby/rouge#280)
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Jul 6, 2015
- add integration with Rouge for highlighting source listings
- use no-break space for indent guard instead of zero-width space
- guard indentation within Rouge formatter
- organize the code to setup source highlighting
- enable line number support when highlighting with Rouge
- add pastie theme for Rouge
- patch Rouge style lookup (see rouge-ruby/rouge#280)
- cast lookup collections to set
- optimize code
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Jul 6, 2015
- add integration with Rouge for highlighting source listings
- use no-break space for indent guard instead of zero-width space
- guard indentation within Rouge formatter
- organize the code to setup source highlighting
- enable line number support when highlighting with Rouge
- add pastie theme for Rouge
- patch Rouge style lookup (see rouge-ruby/rouge#280)
- cast lookup collections to set
- optimize code
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Jul 6, 2015
- add integration with Rouge for highlighting source listings
- use no-break space for indent guard instead of zero-width space
- guard indentation within Rouge formatter
- organize the code to setup source highlighting
- enable line number support when highlighting with Rouge
- add pastie theme for Rouge
- patch Rouge style lookup (see rouge-ruby/rouge#280)
- cast lookup collections to set
- optimize code
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Jul 6, 2015
- add integration with Rouge for highlighting source listings
- use no-break space for indent guard instead of zero-width space
- guard indentation within Rouge formatter
- organize the code to setup source highlighting
- enable line number support when highlighting with Rouge
- add pastie theme for Rouge
- patch Rouge style lookup (see rouge-ruby/rouge#280)
- cast lookup collections to set
- optimize code
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Jul 6, 2015
- add integration with Rouge for highlighting source listings
- use no-break space for indent guard instead of zero-width space
- guard indentation within Rouge formatter
- organize the code to setup source highlighting
- enable line number support when highlighting with Rouge
- add pastie theme for Rouge
- patch Rouge style lookup (see rouge-ruby/rouge#280)
- cast lookup collections to set
- optimize code
mojavelinux added a commit that referenced this issue Jul 6, 2015
resolves #247 add support for the Rouge source highlighter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants