Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cubicweb
cubicweb
Commits
be0864a2eec8
Commit
4e9139bd
authored
Sep 25, 2019
by
Laurent Peuch
Browse files
[mod] allow to pass generic additional arguments to pygments HtmlFormatter
parent
a61e0fe17a69
Changes
1
Hide whitespace changes
Inline
Side-by-side
cubicweb/misc/source_highlight.py
View file @
be0864a2
...
...
@@ -22,11 +22,13 @@ def highlight_terminal(code, language):
return
pygments_highlight
(
code
,
get_lexer_by_name
(
language
),
TerminalFormatter
())
def
highlight_html
(
code
,
language
,
linenos
=
False
):
def
highlight_html
(
code
,
language
,
linenos
=
False
,
linenostart
=
1
,
**
kwargs
):
if
not
has_pygments
:
return
str
(
code
)
return
pygments_highlight
(
str
(
code
),
get_lexer_by_name
(
language
),
HtmlFormatter
(
wrapcode
=
True
,
linenos
=
linenos
))
return
pygments_highlight
(
str
(
code
),
get_lexer_by_name
(
language
),
HtmlFormatter
(
wrapcode
=
True
,
linenos
=
linenos
,
linenostart
=
linenostart
,
**
kwargs
))
def
generate_css
():
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment