Skip to content

Commit fc6d0b0

Browse files
Fix hyphens (#77)
* fix: allow auto-hyphenation for the entire document * feat: add `nowrap` class to prevent undesired line breaks * fix: rename utility class `nowrap` -> `whitespace-nowrap` --------- Co-authored-by: Vincent Dörig <dvincdt@gmail.com>
1 parent b1d5d6b commit fc6d0b0

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

index.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ <h2>Contents</h2>
6767
<li><a href="#table-column-aligment">Table Column Alignment</a></li>
6868
</ol>
6969
</li>
70+
<li><a href="#auto-hyphenation">Automatic Hyphenation</a></li>
7071
</ol>
7172
</li>
7273
<li><a href="#language-support">Language Support</a></li>
@@ -247,6 +248,15 @@ <h4 id="table-column-aligment">Table Column Alignment</h4>
247248

248249
<p>See full examples in the <a href="#tables">section about tables</a>.</p>
249250

251+
<h4 id="auto-hyphenation">Automatic Hyphenation</h4>
252+
<p>
253+
By default, hyphenation is allowed for all words in the document when text wraps
254+
across multiple lines, except for code snippets. If you want to avoid this
255+
behaviour for a specific word (for example, for a hyphenated compound word),
256+
you can use the <code class="language-css">whitespace-nowrap</code> utility class to
257+
prevent line breaks inside an element.
258+
</p>
259+
250260
<h2 id="language-support">Language Support</h2>
251261
<p>
252262
The labels of theorems, definitions, lemmas and proofs can be changed

style.css

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,14 +197,16 @@ body {
197197
background-color: var(--body-bg-color);
198198

199199
text-rendering: optimizeLegibility;
200-
}
201200

202-
/* Justify and hyphenate all paragraphs */
203-
p {
204-
text-align: justify;
201+
/* Allow automatic hyphenation for all text in the document */
205202
hyphens: auto;
206203
-webkit-hyphens: auto;
207204
-moz-hyphens: auto;
205+
}
206+
207+
/* Justify all paragraphs */
208+
p {
209+
text-align: justify;
208210
margin-top: 1rem;
209211
}
210212

@@ -682,6 +684,11 @@ input.sidenote-toggle {
682684
line-height: 1ex;
683685
}
684686

687+
/* Prevent line breaks inside an element */
688+
.whitespace-nowrap {
689+
white-space: nowrap;
690+
}
691+
685692
/* Heading typography */
686693
h1 {
687694
font-size: 2.5rem;

0 commit comments

Comments
 (0)