Issue #325 resolved

HTML line highlighting (GeSHi like)

Pierre Bourdon avatarPierre Bourdon created an issue

I just created a patch which allows the user to give a "hl_lines" list as an option to the HtmlFormatter, then the formatter will use a special background on those lines (surrounded by <span class="hll"></span>).

The patch is attached to this ticket.

Todo: enhance this patch to make it generates the needed css class (span.hll).

Comments (4)

  1. gbrandl

    Added support for specifying a highlight color to styles, added some default highlight colors, and added auto conversion of specified lines to int, to enable command line usage.

    Committed [623c99598be4].

  2. thatch

    Patch looks pretty clean. We should probably short-circuit the call to _highlight_lines if no hl_lines is specified, for speed. Did you have a specific color in mind for the default highlighting, delroth?

  3. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.