diff options
| author | Mark Lodato <lodatom@gmail.com> | 2011-07-06 22:58:19 -0400 |
|---|---|---|
| committer | Mark Lodato <lodatom@gmail.com> | 2011-07-06 22:58:19 -0400 |
| commit | 5fd34b95252e77aa4425adc8a6f12e2dc8fc8ba8 (patch) | |
| tree | 6ee732a6d23a456b408278b88cc07c34e126ae13 /doc/markup/code.rst | |
| parent | d983b98d4ce162ba4dfa27944d6c735c9f01e3cc (diff) | |
| download | sphinx-5fd34b95252e77aa4425adc8a6f12e2dc8fc8ba8.tar.gz | |
add :emphasize-lines: option to source-code and literal-include
Add a new option, :emphasize-lines:, to the source-code and
literal-include directives. The format is the same as the :lines:
option for literal-include. The resulting list of lines is passed to
the Pygments formatter as 'hl_lines', which is only honored by the HTML
formatter.
Diffstat (limited to 'doc/markup/code.rst')
| -rw-r--r-- | doc/markup/code.rst | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/doc/markup/code.rst b/doc/markup/code.rst index eaaf17d0..8f6d5524 100644 --- a/doc/markup/code.rst +++ b/doc/markup/code.rst @@ -86,6 +86,18 @@ on line numbers for the individual block:: Some more Ruby code. +Additionally, an ``emphasize-lines`` option can be given to have Pygments +emphasize particular lines:: + + .. code-block:: python + :emphasize-lines: 3,5 + + def some_function(): + interesting = False + print 'This line is highlighted.' + print 'This one is not...' + print '...but this one is.' + Includes ^^^^^^^^ @@ -107,11 +119,13 @@ Includes desired tab width. The directive also supports the ``linenos`` flag option to switch on line - numbers, and a ``language`` option to select a language different from the - current file's standard language. Example with options:: + numbers, the ``emphasize-lines`` option to emphasize particular lines, and + a ``language`` option to select a language different from the current + file's standard language. Example with options:: .. literalinclude:: example.rb :language: ruby + :emphasize-lines: 12,15-18 :linenos: Include files are assumed to be encoded in the :confval:`source_encoding`. |
