Skip to content

Commit

Permalink
boxes: codehilite: Use pygments:w style for inline code.
Browse files Browse the repository at this point in the history
This comment introduces the same style used for plain codeblocks
for inline code.

Tests amended.
  • Loading branch information
Rohitth007 committed Jun 22, 2021
1 parent 587da17 commit 111f4c4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tests/ui/test_ui_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -1395,7 +1395,7 @@ def test_private_message_to_self(self, mocker):
[("msg_mention", "@A Group")],
id="group-mention",
),
case("<code>some code", [("msg_code", "some code")], id="code"),
case("<code>some code", [("pygments:w", "some code")], id="inline-code"),
case(
'<div class="codehilite" data-code-language="python">'
"<pre><span></span>"
Expand Down
9 changes: 7 additions & 2 deletions zulipterminal/ui_tools/boxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1129,8 +1129,13 @@ def soup2markup(
# BLOCKQUOTE TEXT
markup.append(("msg_quote", cls.soup2markup(element, metadata)[0]))
elif tag == "code":
# CODE (INLINE?)
markup.append(("msg_code", tag_text))
"""
CODE INLINE
-----------
Uses the same style as plain codeblocks
which is the `whitespace` token of pygments.
"""
markup.append(("pygments:w", tag_text))
elif tag == "div" and "codehilite" in tag_classes:
"""
CODE BLOCK
Expand Down

0 comments on commit 111f4c4

Please sign in to comment.