Skip to content

Commit 7fdda8d

Browse files
committed
day 2
1 parent 5d0594f commit 7fdda8d

File tree

2 files changed

+73
-1
lines changed

2 files changed

+73
-1
lines changed
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
title: "Css Flows"
3+
date: 2025-01-02T08:04:56-08:00
4+
tags: [dev, distractions, website]
5+
categories: [Dev]
6+
---
7+
8+
I figured out what was bothering me about the post layout, and it's CSS.
9+
10+
<!--more-->
11+
12+
I write these in Markdown. When they get rendered as a site, there are a few
13+
expectations to how that will work. Lets you infer how it's supposed to look
14+
in the final render, while also allowing you to make the actual markdown text
15+
file look good and easy to read.
16+
17+
The standard rule is that a single line break between text in the markdown file
18+
should be ignored, and it'll get re-flowed in the rendered version.
19+
20+
```
21+
This is funny spaced
22+
text
23+
for example
24+
purposes.
25+
```
26+
27+
Note how there it's written on several different lines. Instead, it should look
28+
like the paragraph below.
29+
30+
*This is funny spaced
31+
text
32+
for example
33+
purposes.*
34+
35+
See how it renders all on one line, with the expected line wrappings.
36+
37+
This was happening because the default style for the blog posts was using a
38+
CSS feature called `white-space: pre-wrap` which basically assumes that you want
39+
to maintain any existing spacing and line breaks. This means that it made all
40+
the linebreaks in the markdown file to be significant. There's nothing wrong
41+
with it, it's just unexpected. But I don't want to have to think about layout,
42+
so I've turned that back to normal.
43+
44+
A second feature that was on was `text-justify`. This spread the text across a
45+
line so it will largely fill a column. In multi-column layouts, this is probably
46+
a good thing. It also allows for meaningful hyphenation at line ends.
47+
However, it makes all the paragraphs look the same! It's too easy to lose your
48+
space. I've turned those off for now, since this isn't print media. I don't have
49+
as much to worry about.
50+
51+
I like how the paragraphs have a different, wobbly right edge. Makes it easier
52+
for me to read. Benefit of my own space. I can do what I like. I reserve the
53+
right to change it later. It might be fine with other adjustments too.
54+
55+
I was a little concerned that changing these would affect the code rendering
56+
and highlighting, that this hugo theme made quite handy:
57+
58+
```go
59+
import "fmt"
60+
61+
func main() {
62+
fmt.Println("Hello, World!")
63+
if true {
64+
fmt.Println("Very long run on sentence just to see what happens if the text needs to wrap or something like that.")
65+
}
66+
}
67+
```
68+
69+
But it looks fine to me. The renderer has too many additional structures and
70+
wrappings to make sure the syntax highlighting is correct.
71+
72+
I'll take it.

themes/hugo-coder/assets/scss/_content.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
// hyphens: auto;
6060

6161
white-space: normal;
62-
width: 70rem;
62+
width: 60rem;
6363
}
6464
}
6565

0 commit comments

Comments
 (0)