Skip to content

Commit 3d32259

Browse files
style: squeeze text and center it on page
Reasoning --------- The idea behind limiting the text's width is to make it easier for users on large screens to read it. Many professionals[1][2][3] recommend somewhere in the 60-80 words per line, as such this commit adds a max width to text of 600px, which should be roughly 60-70 words per line. Technical implementation ------------------------ The technical implementation wraps every "text" content in a class, and limits the width of that class's children. This is done as to not limit the content of the whole page, and in particular the categories cards. In addition the page's content is centered for aesthetic reasons. [1]: https://www.w3.org/WAI/WCAG21/Understanding/visual-presentation.html#:~:text=For%20people%20with%20some,80%20characters%20or%20glyphs [2]: http://web-accessibility.carnegiemuseums.org/design/font/#:~:text=Line%20length,longer%20length [3]: https://www.uutilsynet.no/veiledning/tekst-og-struktur/226#:~:text=For%20best%20mulig%20lesbarhet,inkludert%20mellomrom
1 parent a5d50ac commit 3d32259

File tree

3 files changed

+25
-3
lines changed

3 files changed

+25
-3
lines changed

generate.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,10 @@ def read_section(path):
4646
if row["Notes"] != "":
4747
out += "<hr />"
4848
out += mdspan(row["Notes"], "notes")
49-
out += '</div>'
49+
out += '</div>\n'
5050
out += '</div>'
51+
else:
52+
out = f"""<div class="content" markdown="block">{out}</div>"""
5153

5254
return out
5355

@@ -113,7 +115,7 @@ def generate_command_table():
113115
if not ent_path.endswith(".md"): continue
114116
md_str += read_section(ent_path[:-3])
115117

116-
md = markdown.Markdown(extensions=['toc'])
118+
md = markdown.Markdown(extensions=['toc', 'md_in_html'])
117119
content = md.convert(md_str)
118120

119121
with open("template.html", "r") as f:

out/style.css

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,21 @@ nav a {
7878
display: block;
7979
}
8080

81+
.title {
82+
display: block;
83+
max-width: 600px;
84+
margin-left: auto;
85+
margin-right: auto;
86+
}
87+
88+
.content {
89+
& p, & ul, & li, & h1, & h2, & h3, & h4, & h5, & h6 {
90+
max-width: 600px;
91+
margin-left: auto;
92+
margin-right: auto;
93+
}
94+
}
95+
8196
main {
8297
padding: 0 20px;
8398
margin-top: calc(30px + 48px); /* Offset the main content to appear under the menu on mobile */
@@ -193,6 +208,11 @@ p, li {
193208
margin: 1em 0 1em 0;
194209
}
195210

211+
table.commands {
212+
margin-left: auto;
213+
margin-right: auto;
214+
}
215+
196216
table.commands tbody {
197217
display: block;
198218

template.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ <h2>Portal 2 Rules</h2>
1717
{{NAV_MENU}}
1818
</nav>
1919
<main>
20-
<h1>Portal 2 Rules</h1>
20+
<h1 class="title">Portal 2 Rules</h1>
2121
{{CONTENT}}
2222
</main>
2323
</body>

0 commit comments

Comments
 (0)