Provide for code-block syntax highlighting.

modified:   doc/README
modified:   doc/webp-lossless-bitstream-spec.txt

Change-Id: I5cbc9c0a4fbbcc049a4d792e1fac367d28acf4a6
This commit is contained in:
Lou Quillio
2012-06-01 12:02:41 -07:00
parent 709d770241
commit b3ec18c556
2 changed files with 51 additions and 4 deletions

View File

@ -1,6 +1,6 @@
Generate HTML Container Spec Doc from Text Source
=================================================
Generate libwebp Container Spec Docs from Text Source
=====================================================
HTML generation requires kramdown [1], easily installed as a
rubygem [2]. Rubygems installation should satisfy dependencies
@ -13,3 +13,23 @@ HTML generation can then be done from the project root:
$ kramdown doc/webp-container-spec.txt --template doc/template.html > \
doc/output/webp-container-spec.html
kramdown can optionally syntax highlight code blocks, using CodeRay [3],
a dependency of kramdown that rubygems will install automatically. The
following will apply inline CSS styling, and then use perl to strip
line numbers and unwanted leading whitespace.
$ kramdown doc/webp-lossless-bitstream-spec.txt --template \
doc/template.html --coderay-css style | \
perl -p -e 's|<span class="no">.*?</span>\s||gm' > \
doc/output/webp-lossless-bitstream-spec.html
Note that code blocks must be immediately followed by a language
identifier for syntax highlighting to succeed. Example:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
int block_index = (y >> size_bits) * block_xsize +
(x >> size_bits);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{:lang='c'}