Skip to content

Commit 5f19268

Browse files
committed
word-wrap rule links
1 parent d5cdf55 commit 5f19268

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

mdbook-spec/src/rules.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,10 @@ impl Spec {
105105
}
106106
format!(
107107
"<div class=\"rule\" id=\"r-{rule_id}\">\
108-
<a class=\"rule-link\" href=\"#r-{rule_id}\">[{rule_id}]</a>\
108+
<a class=\"rule-link\" href=\"#r-{rule_id}\">[{rule_id_broken}]</a>\
109109
{test_html}\
110-
</div>\n"
110+
</div>\n",
111+
rule_id_broken = rule_id.replace(".", "<wbr>."),
111112
)
112113
})
113114
.to_string()

theme/reference.css

+2
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,8 @@ main > .rule {
284284
float: right;
285285
text-align: right;
286286
padding-right: 10px;
287+
/* We add `<wbr>` ourselves and only want breaks there */
288+
word-break: keep-all;
287289
/* Remove the blue coloring of links on rules that mdbook normally sets. */
288290
color: #999 !important;
289291
}

0 commit comments

Comments
 (0)