aboutsummaryrefslogtreecommitdiffstats
path: root/docs/extensions/code_hilite.txt
diff options
context:
space:
mode:
Diffstat (limited to 'docs/extensions/code_hilite.txt')
-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)']
... )