Skip to content

Commit a9c4aab

Browse files
committed
support html inline
1 parent ee8378c commit a9c4aab

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

‎rich/default_styles.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@
165165
"markdown.s": Style(strike=True),
166166
"markdown.table.border": Style(color="cyan"),
167167
"markdown.table.header": Style(color="cyan", bold=False),
168+
"markdown.kbd": Style(bold=True, color="bright_yellow"),
168169
"iso8601.date": Style(color="blue"),
169170
"iso8601.time": Style(color="magenta"),
170171
"iso8601.timezone": Style(color="yellow"),

‎rich/markdown.py‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,14 @@ def __rich_console__(
615615
context.enter_style(link_style)
616616
else:
617617
context.stack.push(Link.create(self, token))
618+
elif node_type == "html_inline":
619+
if token.content == "<kbd>":
620+
kbd_style = console.get_style("markdown.kbd", default="bold")
621+
context.enter_style(kbd_style)
622+
elif token.content == "</kbd>":
623+
context.leave_style()
624+
else:
625+
continue
618626
elif node_type == "link_close":
619627
if self.hyperlinks:
620628
context.leave_style()

0 commit comments

Comments
 (0)