Skip to content

Commit

Permalink
fix: Propagate the CSS class to inline highlighting as well
Browse files Browse the repository at this point in the history
  • Loading branch information
oprypin committed Feb 24, 2021
1 parent 5d6800b commit c7d80e6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/mkdocstrings/handlers/rendering.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def highlight( # noqa: W0221 (intentionally different params, we're extending t
self.linenums = old_linenums

if inline:
return Markup(f'<code class="highlight language-{language}">{result.text}</code>')
return Markup(f'<code class="{kwargs["css_class"]} language-{language}">{result.text}</code>')
return Markup(result)


Expand Down
2 changes: 1 addition & 1 deletion tests/test_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def test_highlighter_without_pygments(extension_name):
)
assert (
hl.highlight("import foo", language="python", inline=True)
== '<code class="highlight language-python">import foo</code>'
== '<code class="hiiii language-python">import foo</code>'
)


Expand Down

0 comments on commit c7d80e6

Please sign in to comment.