From: Guenter M. <mi...@us...> - 2008-10-08 09:43:31
|
Mark Nodine <mar...@au...> schrieb: > Guenter Milde wrote: > > David Goodger <go...@py...> schrieb: > >> A syntax highlighting directive is a common request, and there are > >> several implementations out there. Let's work on generalizing the > >> directive for all of Docutils (so it works with all writers), and move > >> it into the parser code. > Just for your info, the Perl reStructuredText has a syntax highlighting > directive already, and it has the same name and syntax. One more argument to get a code-block directive into Docutils: It's a much wanted feature and unifying the approchaes in the "reStructuredText reference implementation" would be good. > Regarding the two levels of markup, it really does both. Without > any options, it returns basically a parsed-literal block. If you > give it the :color: option, it produces the high-level markup, which > in the HTML writer at least, sets the span styles according to the > syntax categories. This is a misunderstanding: my high-level/low-level distinction was about the internal representation in the doctree: low-level: store content un-parsed but tag with "code-block" and "language" classes. Parse during the writing. high-level: parse during the reading, store as "rich" text (tagging the individual objects like keywords or strings). Write similar to a parsed-literal block. In both cases, the colouring is actually done by a style-sheet. This distinction is special to the inner workings of docutils and might be not applicable to `prest`. > It has a few other options that you might want to consider. > Check out the details at > http://www.prest.de/doc/directives.html#including-a-marked-up-code-block Thanks for the pointer. Günter |