Skip to content

Commit c7c0ae8

Browse files
authored
README: Add styling for <kbd> tags (#6423)
1 parent 1c9d7e5 commit c7c0ae8

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

app/components/rendered-html.module.css

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,21 @@
3939
font-family: var(--font-monospace);
4040
}
4141

42+
kbd {
43+
font-family: var(--font-monospace);
44+
font-size: 11px;
45+
46+
padding: 2px 5px 3px 5px;
47+
48+
border-radius: 7px;
49+
50+
position: relative;
51+
bottom: 2px;
52+
53+
border: 1px solid var(--grey700);
54+
box-shadow: inset 0 -2px 0 var(--grey600);
55+
}
56+
4257
table {
4358
border-collapse: collapse;
4459
display: block;

cargo-registry-markdown/lib.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,16 @@ mod tests {
329329
assert_eq!(result, "<p>foo_readme</p>\n<p>alert(\'Hello World\')</p>\n");
330330
}
331331

332+
#[test]
333+
fn text_with_kbd_tag() {
334+
let text = "foo_readme\n\nHello <kbd>alert('Hello World')</kbd>";
335+
let result = markdown_to_html(text, None, "");
336+
assert_eq!(
337+
result,
338+
"<p>foo_readme</p>\n<p>Hello <kbd>alert(\'Hello World\')</kbd></p>\n"
339+
);
340+
}
341+
332342
#[test]
333343
fn text_with_inline_javascript() {
334344
let text = r#"foo_readme\n\n<a href="https://crates.io/crates/cargo-registry" onclick="window.alert('Got you')">Crate page</a>"#;

0 commit comments

Comments
 (0)