Reformat
This commit is contained in:
parent
13b1d54ac3
commit
2633db27d8
1 changed files with 11 additions and 2 deletions
|
@ -18,6 +18,7 @@ except ImportError:
|
||||||
return _make_pre_code(code)
|
return _make_pre_code(code)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
def highlight_code(code, language, cssclass="codehilite", linenos=True):
|
def highlight_code(code, language, cssclass="codehilite", linenos=True):
|
||||||
try:
|
try:
|
||||||
lexer = pygments.lexers.get_lexer_by_name(language)
|
lexer = pygments.lexers.get_lexer_by_name(language)
|
||||||
|
@ -27,9 +28,17 @@ else:
|
||||||
if linenos:
|
if linenos:
|
||||||
return mark_safe(
|
return mark_safe(
|
||||||
pygments.highlight(
|
pygments.highlight(
|
||||||
code, lexer, pygments.formatters.HtmlFormatter(cssclass=cssclass, linenos="table", wrapcode=True)
|
code,
|
||||||
|
lexer,
|
||||||
|
pygments.formatters.HtmlFormatter(
|
||||||
|
cssclass=cssclass, linenos="table", wrapcode=True
|
||||||
|
),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
return mark_safe(
|
return mark_safe(
|
||||||
pygments.highlight(code, lexer, pygments.formatters.HtmlFormatter(cssclass=cssclass, wrapcode=True))
|
pygments.highlight(
|
||||||
|
code,
|
||||||
|
lexer,
|
||||||
|
pygments.formatters.HtmlFormatter(cssclass=cssclass, wrapcode=True),
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue