aboutsummaryrefslogtreecommitdiffstats
path: root/docs/extensions
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2013-02-14 16:04:24 -0500
committerWaylan Limberg <waylan@gmail.com>2013-02-14 16:04:24 -0500
commit36ab0c387f84485444e60480382caafb7a807fd6 (patch)
tree7b2613b9cee201d2cc8eb3fb544d8e34d5e7158d /docs/extensions
parentfdfc84405ba690705ff343d46ab658bfc50a8836 (diff)
downloadmarkdown-36ab0c387f84485444e60480382caafb7a807fd6.tar.gz
markdown-36ab0c387f84485444e60480382caafb7a807fd6.tar.bz2
markdown-36ab0c387f84485444e60480382caafb7a807fd6.zip
Allow better linenum override in CodeHilite
Fixes #148. The "force_linenos" config setting of the CodeHilite extension has been marked as Pending Deprecation and a new setting "linenums" has been added to replace it. See documentation for the [CodeHilite Extension] for an explaination of the new "linenums" setting. The new setting will honor the old "force_linenos" if it is set, but it will raise a PendingDeprecationWarning and will likely be removed in a future version of Python-Markdown. [CodeHilite Extension]: extensions/codehilite.html
Diffstat (limited to 'docs/extensions')
-rw-r--r--docs/extensions/code_hilite.txt25
1 files changed, 19 insertions, 6 deletions
diff --git a/docs/extensions/code_hilite.txt b/docs/extensions/code_hilite.txt
index fbf05b3..31ecfbb 100644
--- a/docs/extensions/code_hilite.txt
+++ b/docs/extensions/code_hilite.txt
@@ -41,6 +41,13 @@ 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.
+!!! Note
+The format of the language identifier only effects the display of line numbers
+if `linenums` is set to `None` (the default). If set to `True` or `False`
+(see [Usage](#usage) below) the format of the identifier has no effect on the
+display of line numbers -- it only serves as a means to define the language
+of the code block.
+
[syntax]: http://daringfireball.net/projects/markdown/syntax#precode
###SheBang (with path)
@@ -107,19 +114,25 @@ Usage
From the Python interpreter:
- >>> html = markdown.markdown(text, ['codehilite'])
+ >>> html = markdown.markdown(text, extensions=['codehilite'])
+
+If you want to force every code block to have line numbers, even when using
+colons (`:::`) for language identification, set `linenums` to `True`.
+
+ >>> html = markdown.markdown(text,
+ ... extensions=['codehilite(linenums=True)']
+ ... )
-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.
+If you do **not** want any code block to have line numbers, even when using
+SheBangs (`#!`) for language identification, set `linenums` to `False`.
>>> html = markdown.markdown(text,
- ... ['codehilite(force_linenos=True)']
+ ... extensions=['codehilite(linenums=False)']
... )
If you want to prevent Pygments from guessing the language, only highlighting
blocks when you explicitly request it, set the `guess_lang` setting to 'False'.
>>> html = markdown.markdown(text,
- ... ['codehilite(guess_lang=False)']
+ ... extensions=['codehilite(guess_lang=False)']
... )