On 2012-08-18, Boris Kheyfets wrote:

> [-- Type: text/plain, Encoding:  --]

> Is somehow possible to highlight a piece of text in line in a given 
> language (with pygments)?

> Something like this:

> Some text :myLanguage:`from i to j; do` some more text.

Yes, there is the :code: role for this since Docutils 0.8. In order to
highlight a language, you must define a custom role 
http://docutils.sourceforge.net/docs/ref/rst/directives.html#custom-interpreted-text-roles
based on "code".

Example from the "standard.txt" test file:

  For inline code snippets, there is the `code` role, which can be used
  directly (the code will not be parsed/tagged, as the language is not
  known) or as base for special code roles, e.g.,
  
  .. role:: tex(code)
     :language: latex
  
  
  Docutils uses LaTeX syntax for math directives and roles:
  :tex:`\alpha = f(x)` prints :math:`\alpha = f(x)`.

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-dev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sphinx-dev?hl=en.

Reply via email to