aboutsummaryrefslogtreecommitdiffstats
path: root/docs/extensions/code_hilite.txt
diff options
context:
space:
mode:
authorTiago Serafim <tserafim@gmail.com>2012-09-19 18:43:21 -0300
committerTiago Serafim <tserafim@gmail.com>2012-09-19 18:43:21 -0300
commit85e74fb710e64a35b3ed458bdec6cfed7827c3b1 (patch)
tree0f036613cca208a1cb0505348f308d3d13bd908a /docs/extensions/code_hilite.txt
parent9756cb9f6014347179a9acf54a739aad5dda0c6d (diff)
downloadmarkdown-85e74fb710e64a35b3ed458bdec6cfed7827c3b1.tar.gz
markdown-85e74fb710e64a35b3ed458bdec6cfed7827c3b1.tar.bz2
markdown-85e74fb710e64a35b3ed458bdec6cfed7827c3b1.zip
First version of the docs.
Diffstat (limited to 'docs/extensions/code_hilite.txt')
-rw-r--r--docs/extensions/code_hilite.txt46
1 files changed, 23 insertions, 23 deletions
diff --git a/docs/extensions/code_hilite.txt b/docs/extensions/code_hilite.txt
index 55a1a00..fbf05b3 100644
--- a/docs/extensions/code_hilite.txt
+++ b/docs/extensions/code_hilite.txt
@@ -1,6 +1,6 @@
title: CodeHilite Extension
-prev_title: Smart Strong Extension
-prev_url: smart_strong.html
+prev_title: Admonition Extension
+prev_url: admonition.html
next_title: HTML Tidy Extension
next_url: html_tidy.html
@@ -10,7 +10,7 @@ CodeHilite
Summary
-------
-The CodeHilite Extension adds code/syntax highlighting to standard
+The CodeHilite Extension adds code/syntax highlighting to standard
Python-Markdown code blocks using [Pygments][].
[Pygments]: http://pygments.org/
@@ -20,32 +20,32 @@ This extension is included in the Markdown library.
Setup
-----
-You will also need to [download][dl] and install the Pygments package on your
+You will also need to [download][dl] and install the Pygments package on your
`PYTHONPATH`. You will need to determine the appropriate CSS classes and create
-appropriate rules for them, which are either defined in or linked from the
-header of your HTML templates. See the excellent [documentation][] for more
-details. If no language is defined, Pygments will attempt to guess the
+appropriate rules for them, which are either defined in or linked from the
+header of your HTML templates. See the excellent [documentation][] for more
+details. If no language is defined, Pygments will attempt to guess the
language. When that fails, the code block will display as un-highlighted code.
[dl]: http://pygments.org/download/
[documentation]: http://pygments.org/docs
-**Note:** The css and/or javascript is not included as part of this extension
+**Note:** The css and/or javascript is not included as part of this extension
but shall always be provided by the end user.
Syntax
------
-The CodeHilite Extension follows the same [syntax][] as regular Markdown code
-blocks, with one exception. The hiliter needs to know what language to use for
-the code block. There are three ways to tell the hiliter what language the code
+The CodeHilite Extension follows the same [syntax][] as regular Markdown code
+blocks, with one exception. The hiliter needs to know what language to use for
+the code block. There are three ways to tell the hiliter what language the code
block contains and each one has a different result.
[syntax]: http://daringfireball.net/projects/markdown/syntax#precode
###SheBang (with path)
-If the first line of the codeblock contains a shebang, the language is derived
+If the first line of the codeblock contains a shebang, the language is derived
from that and line numbers are used.
#!/usr/bin/python
@@ -59,8 +59,8 @@ Will result in:
###SheBang (no path)
-If the first line contains a shebang, but the shebang line does not contain a
-path (a single `/` or even a space), then that line is removed from the code
+If the first line contains a shebang, but the shebang line does not contain a
+path (a single `/` or even a space), then that line is removed from the code
block before processing. Line numbers are used.
#!python
@@ -72,8 +72,8 @@ Will result in:
####Colons
-If the first line begins with three or more colons, the text following the
-colons identifies the language. The first line is removed from the code block
+If the first line begins with three or more colons, the text following the
+colons identifies the language. The first line is removed from the code block
before processing and line numbers are not used.
:::python
@@ -85,10 +85,10 @@ Will result in:
###When No Language is Defined
-CodeHilite is completely backward compatible so that if a code block is
-encountered that does not define a language, the block is simple wrapped in
-`<pre>` tags and output. Note: one exception would be that the Pygments
-highlighting engine will try to guess the language. Upon failure, the same
+CodeHilite is completely backward compatible so that if a code block is
+encountered that does not define a language, the block is simple wrapped in
+`<pre>` tags and output. Note: one exception would be that the Pygments
+highlighting engine will try to guess the language. Upon failure, the same
behavior will happen as described here.
# Code goes here ...
@@ -109,11 +109,11 @@ From the Python interpreter:
>>> html = markdown.markdown(text, ['codehilite'])
-If you want every code block to have line numbers, even when using colons
-(`:::`) for language identification, the setting `force_linenos` is available
+If you want every code block to have line numbers, even when using colons
+(`:::`) for language identification, the setting `force_linenos` is available
to do so.
- >>> html = markdown.markdown(text,
+ >>> html = markdown.markdown(text,
... ['codehilite(force_linenos=True)']
... )