Skip to content

Commit bfed632

Browse files
committed
Add TOC and styling to posts
1 parent a4efa21 commit bfed632

39 files changed

+736
-93
lines changed

Gemfile.lock

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,6 @@ GEM
7272
sass-embedded (~> 1.75)
7373
jekyll-seo-tag (2.8.0)
7474
jekyll (>= 3.8, < 5.0)
75-
jekyll-toc (0.19.0)
76-
jekyll (>= 3.9)
77-
nokogiri (~> 1.12)
7875
jekyll-watch (2.2.1)
7976
listen (~> 3.0)
8077
json (2.9.1)
@@ -87,34 +84,13 @@ GEM
8784
rb-fsevent (~> 0.10, >= 0.10.3)
8885
rb-inotify (~> 0.9, >= 0.9.10)
8986
mercenary (0.4.0)
90-
mini_portile2 (2.8.9)
9187
minima (2.5.2)
9288
jekyll (>= 3.5, < 5.0)
9389
jekyll-feed (~> 0.9)
9490
jekyll-seo-tag (~> 2.1)
95-
nokogiri (1.18.8)
96-
mini_portile2 (~> 2.8.2)
97-
racc (~> 1.4)
98-
nokogiri (1.18.8-aarch64-linux-gnu)
99-
racc (~> 1.4)
100-
nokogiri (1.18.8-aarch64-linux-musl)
101-
racc (~> 1.4)
102-
nokogiri (1.18.8-arm-linux-gnu)
103-
racc (~> 1.4)
104-
nokogiri (1.18.8-arm-linux-musl)
105-
racc (~> 1.4)
106-
nokogiri (1.18.8-arm64-darwin)
107-
racc (~> 1.4)
108-
nokogiri (1.18.8-x86_64-darwin)
109-
racc (~> 1.4)
110-
nokogiri (1.18.8-x86_64-linux-gnu)
111-
racc (~> 1.4)
112-
nokogiri (1.18.8-x86_64-linux-musl)
113-
racc (~> 1.4)
11491
pathutil (0.16.2)
11592
forwardable-extended (~> 2.6)
11693
public_suffix (6.0.1)
117-
racc (1.8.1)
11894
rake (13.2.1)
11995
rb-fsevent (0.11.2)
12096
rb-inotify (0.11.1)
@@ -193,7 +169,6 @@ DEPENDENCIES
193169
jekyll (~> 4.4.1)
194170
jekyll-feed (~> 0.12)
195171
jekyll-redirect-from
196-
jekyll-toc
197172
minima (~> 2.5)
198173
tzinfo (>= 1, < 3)
199174
tzinfo-data

_includes/toc.html

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{% comment %}
2+
This creates a table of contents from headings in your content
3+
GitHub Pages compatible - no plugins required
4+
Preserves formatting like italics and bold in TOC links
5+
{% endcomment %}
6+
7+
{% assign toc_items = '' | split: '' %}
8+
{% assign html_content = content | markdownify %}
9+
10+
{% comment %} Use regex-like approach to find headings {% endcomment %}
11+
{% assign heading_sections = html_content | split: '<h' %}
12+
13+
{% for section in heading_sections %}
14+
{% if section contains '</h' %}
15+
{% comment %} Get the heading level {% endcomment %}
16+
{% assign level_char = section | slice: 0, 1 %}
17+
{% assign level = level_char | plus: 0 %}
18+
19+
{% if level >= 2 and level <= 6 %}
20+
{% comment %} Find everything after the first > and before the closing tag {% endcomment %}
21+
{% assign parts = section | split: '>' %}
22+
{% if parts.size > 1 %}
23+
{% assign remaining = parts | shift | join: '>' %}
24+
{% assign heading_content = remaining | split: '</h' | first %}
25+
26+
{% comment %} Create clean ID from text-only version {% endcomment %}
27+
{% assign clean_text = heading_content | strip_html | strip %}
28+
{% assign heading_id = clean_text | downcase | replace: ' ', '-' | replace: ':', '' | replace: '?', '' | replace: '!', '' | replace: '.', '' | replace: ',', '' | replace: ';', '' | replace: '"', '' | replace: "'", '' | replace: '(', '' | replace: ')', '' | replace: '[', '' | replace: ']', '' | replace: '{', '' | replace: '}', '' | replace: '/', '' | replace: '\', '' | replace: '+', '' | replace: '=', '' | replace: '*', '' | replace: '&', '' | replace: '%', '' | replace: '$', '' | replace: '#', '' | replace: '@', '' | replace: '<', '' | replace: '>', '' %}
29+
{% assign heading_id = heading_id | replace: '--', '-' | replace: '--', '-' %}
30+
31+
{% assign toc_item = level | append: '|||' | append: heading_id | append: '|||' | append: heading_content %}
32+
{% assign toc_items = toc_items | push: toc_item %}
33+
{% endif %}
34+
{% endif %}
35+
{% endif %}
36+
{% endfor %}
37+
38+
{% if toc_items.size > 0 %}
39+
<div class="table-of-contents">
40+
<h3>Page Contents</h3>
41+
<ul>
42+
{% for item in toc_items %}
43+
{% assign parts = item | split: '|||' %}
44+
{% assign level = parts[0] %}
45+
{% assign id = parts[1] %}
46+
{% assign text = parts[2] %}
47+
<li class="toc-level-{{ level }}">
48+
<a href="#{{ id }}">{{ text }}</a>
49+
</li>
50+
{% endfor %}
51+
</ul>
52+
</div>
53+
{% endif %}

_layouts/post.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ <h1 class="post-title p-name">{{ page.title | markdownify | remove: '<p>' | remo
2020
{%- endif -%}
2121
</header>
2222
<div class="post-content e-content">
23-
{{ content }}
24-
</div>
23+
{% include toc.html %}
24+
{{ content }}
25+
</div>
2526
</article>

_site/2020/06/08/elantris.html

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,18 @@ <h1 class="post-title p-name"><em>Elantris</em> has a great plot, but a disappoi
5050
</a>
5151
</header>
5252
<div class="post-content e-content">
53-
<p><em>Elantris</em> is the first book I’ve read by Brandon Sanderson, an author I keep hearing about from a lot of different people.</p>
53+
54+
55+
56+
57+
58+
59+
60+
61+
62+
63+
64+
<p><em>Elantris</em> is the first book I’ve read by Brandon Sanderson, an author I keep hearing about from a lot of different people.</p>
5465

5566
<p>A year ago, I wouldn’t have said I was a fantasy fan – in fact, I kind of scorned fantasy in favor of science fiction. Now, I just think I wasn’t reading the right books. For example, I tried to gut my way through the Lightbringer series (Brent Weeks) almost two years ago on a friend’s recommendation. I thought the magic system was cool, but I couldn’t get into the plot and wasn’t a fan of the main character. I also thought the writing was sort of shit. But, last year, my coworker kept talking about Patrick Rothfuss and his book <em>The Name of the Wind</em>. I thought it sounded all right, but I wasn’t that interested. My manager offered to lend me her copy, though, and I couldn’t think of a nice way to say no. I borrowed the book and read it and it was fucking awesome. I quickly read The Wise Man’s Fear, the sequel. And now I’m waiting in anticipation for the third book to come out. Another coworker raved about Sanderson. Then, my dad started talking about how he was reading Sanderson’s Mistborn series. I decided to read <em>Elantris</em>, mostly because it wasn’t part of a series.</p>
5667

@@ -72,7 +83,7 @@ <h1 class="post-title p-name"><em>Elantris</em> has a great plot, but a disappoi
7283
<script data-goatcounter="https://dlog.goatcounter.com/count" async="" src="//gc.zgo.at/count.js"></script>
7384

7485

75-
</div>
86+
</div>
7687
</article>
7788
</div>
7889
</main><footer class="site-footer h-card">

_site/2020/06/13/normalpeople.html

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,18 @@ <h1 class="post-title p-name"><em>Normal People</em> is about shifting power dyn
5050
</a>
5151
</header>
5252
<div class="post-content e-content">
53-
<p><em>Normal People</em> is about the power dynamics that are present inside and outside of a romantic relationship and how they shift over time (over years and also over moments) because of the relationship itself, external factors, and individual factors like insecurity and mental health.</p>
53+
54+
55+
56+
57+
58+
59+
60+
61+
62+
63+
64+
<p><em>Normal People</em> is about the power dynamics that are present inside and outside of a romantic relationship and how they shift over time (over years and also over moments) because of the relationship itself, external factors, and individual factors like insecurity and mental health.</p>
5465

5566
<p>What it isn’t is a “love story for the millenial generation.” When people say “love story,” they usually use it to describe a story about love that’s positive or idealistic (<em>Normal People</em> isn’t either one of these) – or if they don’t, they qualify the phrase more (like “tragic love story” or “dark love story”). Or like “millennial love story.” That’s such a generic phrase. What do people mean when they use that phrase? That it’s supposed to characterize a generation? <em>Normal People</em> doesn’t characterize a generation – or if it does, it doesn’t characterize a generation as much as I think it characterizes like college relationships and relationships in general.</p>
5667

@@ -87,7 +98,7 @@ <h1 class="post-title p-name"><em>Normal People</em> is about shifting power dyn
8798
<script data-goatcounter="https://dlog.goatcounter.com/count" async="" src="//gc.zgo.at/count.js"></script>
8899

89100

90-
</div>
101+
</div>
91102
</article>
92103
</div>
93104
</main><footer class="site-footer h-card">

_site/2020/09/26/americanwoman.html

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,18 @@ <h1 class="post-title p-name"><em>American Woman</em> considers how radicalism c
5050
</a>
5151
</header>
5252
<div class="post-content e-content">
53-
<p><em>American Woman</em> is a fictionalization of the Patty Hearst kidnapping and aftermath – specifically, it focuses on the time between the SLA robbery of a sporting goods store in May 1974 and her arrest in April 1975.</p>
53+
54+
55+
56+
57+
58+
59+
60+
61+
62+
63+
64+
<p><em>American Woman</em> is a fictionalization of the Patty Hearst kidnapping and aftermath – specifically, it focuses on the time between the SLA robbery of a sporting goods store in May 1974 and her arrest in April 1975.</p>
5465

5566
<p>The Patty Hearst stuff is the backdrop, anyway. The main character in the book isn’t Patty – it’s Jenny Shimada (i.e. <a href="https://en.wikipedia.org/wiki/Wendy_Yoshimura">Wendy Yoshimura</a>). A few years before the book starts, Jenny bombs a series of federal buildings with her boyfriend to protest the Vietnam War. Her boyfriend got arrested by the FBI, and Jenny went on the run. She’s hiding (new name, new identity) in upstate New York when the book starts.</p>
5667

@@ -79,7 +90,7 @@ <h1 class="post-title p-name"><em>American Woman</em> considers how radicalism c
7990
<script data-goatcounter="https://dlog.goatcounter.com/count" async="" src="//gc.zgo.at/count.js"></script>
8091

8192

82-
</div>
93+
</div>
8394
</article>
8495
</div>
8596
</main><footer class="site-footer h-card">

_site/2021/01/01/ereaders.html

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,18 @@ <h1 class="post-title p-name">I like e-readers now
5454
</a>
5555
</header>
5656
<div class="post-content e-content">
57-
<p>I’ve never been a fan of e-readers. I’m put off by the prospect of paying for a book that only exists on a device, especially when the price of e-books approaches or exceeds the cost of physical books (especially the used copies I tend to buy). I also just love physical books – the weight and feel of them, the experience of reading, the look of books on my shelf.</p>
57+
58+
59+
60+
61+
62+
63+
64+
65+
66+
67+
68+
<p>I’ve never been a fan of e-readers. I’m put off by the prospect of paying for a book that only exists on a device, especially when the price of e-books approaches or exceeds the cost of physical books (especially the used copies I tend to buy). I also just love physical books – the weight and feel of them, the experience of reading, the look of books on my shelf.</p>
5869

5970
<p>However, I recently got a Kobo Libra H20. I’d been thinking about purchasing an e-reader for a few years. I’d only use it for travel, I told myself, after one too many trips of lugging multiple, heavy books on short trips and not having time to read them. I did my research, and chose the Kobo e-reader over the Kindle – I didn’t want to lock myself into the Amazon system, and was happy that the Kobo offered the best integration with OverDrive (a system where you can check out e-copies of books from your local library) since I planned on just using the e-reader for library books. I also decided that the Kobo Libra H20, the fully waterproof Kobo option, would be nice for reading in the bath or on the beach.</p>
6071

@@ -69,7 +80,7 @@ <h1 class="post-title p-name">I like e-readers now
6980
<script data-goatcounter="https://dlog.goatcounter.com/count" async="" src="//gc.zgo.at/count.js"></script>
7081

7182

72-
</div>
83+
</div>
7384
</article>
7485
</div>
7586
</main><footer class="site-footer h-card">

_site/2021/02/04/wharton.html

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,18 @@ <h1 class="post-title p-name"><em>The House of Mirth</em> and <em>The Awakening<
5050
</a>
5151
</header>
5252
<div class="post-content e-content">
53-
<p>I read <em>The House of Mirth</em> and <em>The Awakening</em> almost back to back (one book in between – Susan Choi’s <em>Person of Interest</em>) unintentionally, but I was totally struck by how similar the two books are. <em>The Awakening</em> was published in 1899, while <em>The House of Mirth</em> was published just six years later in 1905. The protagonists, Lily Bart and Edna Pontellier, are also incredibly similar (and, interestingly, almost exactly the same age – Edna turns 28 during the course of The Awakening; Lily is 29 when <em>The House of Mirth</em> begins) – both are in rather precarious positions because of both their own actions and their own yearnings for something more than conventional social life, and both end their own lives because they are unable to find fulfillment through men and society and unwilling to conceive of a life outside of those constraints.</p>
53+
54+
55+
56+
57+
58+
59+
60+
61+
62+
63+
64+
<p>I read <em>The House of Mirth</em> and <em>The Awakening</em> almost back to back (one book in between – Susan Choi’s <em>Person of Interest</em>) unintentionally, but I was totally struck by how similar the two books are. <em>The Awakening</em> was published in 1899, while <em>The House of Mirth</em> was published just six years later in 1905. The protagonists, Lily Bart and Edna Pontellier, are also incredibly similar (and, interestingly, almost exactly the same age – Edna turns 28 during the course of The Awakening; Lily is 29 when <em>The House of Mirth</em> begins) – both are in rather precarious positions because of both their own actions and their own yearnings for something more than conventional social life, and both end their own lives because they are unable to find fulfillment through men and society and unwilling to conceive of a life outside of those constraints.</p>
5465

5566
<p>Lily Bart, the protagonist of <em>The House of Mirth</em>, has the clarity to both see her precarious position and realize that she’s really not suited for a life without wealth. Because of these two things, she knows she must marry for wealth. She knows what she wants and has the social skills to get what she wants (a proposal from a rich man), and beyond that, she has so many opportunities to get exactly what she wants. The issue is, she always gets cold feet at the last moment. Every time she’s about to get someone to propose to is on the verge of accepting a proposal, she gets a conscience and starts to feel bad that she’ll just be marrying for wealth, or she’ll think she can do better, or she thinks oh wait, maybe she doesn’t need wealth, and backs out. And then after she gets cold feet, she has the same realizations (that she really does want luxury and society) all over again and starts the whole useless cycle again, progressively with less and less leverage. She becomes doomed to a “dingy” life and unlike her foil, Gerty Farish, she’s unable to make peace with her circumstances. Then, she dies.</p>
5667

@@ -63,7 +74,7 @@ <h1 class="post-title p-name"><em>The House of Mirth</em> and <em>The Awakening<
6374
<script data-goatcounter="https://dlog.goatcounter.com/count" async="" src="//gc.zgo.at/count.js"></script>
6475

6576

66-
</div>
77+
</div>
6778
</article>
6879
</div>
6980
</main><footer class="site-footer h-card">

_site/2021/04/08/mexicangothic.html

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,18 @@ <h1 class="post-title p-name">I didn’t like <em>Mexican Gothic</em>, but a lot
5050
</a>
5151
</header>
5252
<div class="post-content e-content">
53-
<p>I didn’t like <em>Mexican Gothic</em>, but a lot of other people did. I was so excited about the premise: a gothic novel in 1950s Mexico! I thought, “maybe this will be sort of like a new twist on Jane Eyre.” Yeah, it wasn’t. I was disappointed.</p>
53+
54+
55+
56+
57+
58+
59+
60+
61+
62+
63+
64+
<p>I didn’t like <em>Mexican Gothic</em>, but a lot of other people did. I was so excited about the premise: a gothic novel in 1950s Mexico! I thought, “maybe this will be sort of like a new twist on Jane Eyre.” Yeah, it wasn’t. I was disappointed.</p>
5465

5566
<p>Here is a list of some of the things I didn’t like about the book:</p>
5667

@@ -90,7 +101,7 @@ <h1 class="post-title p-name">I didn’t like <em>Mexican Gothic</em>, but a lot
90101
<script data-goatcounter="https://dlog.goatcounter.com/count" async="" src="//gc.zgo.at/count.js"></script>
91102

92103

93-
</div>
104+
</div>
94105
</article>
95106
</div>
96107
</main><footer class="site-footer h-card">

_site/2021/07/08/snakes.html

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,18 @@ <h1 class="post-title p-name">Don’t sleep, there are tons of boring linguistic
5050
</a>
5151
</header>
5252
<div class="post-content e-content">
53-
<p>I recently finished <em>Don’t Sleep, There are Snakes: Life and Language in the Amazonian Jungle</em>, an autobiographical account of <a href="https://en.wikipedia.org/wiki/Daniel_Everett">Daniel Everett</a>’s time as a Christian missionary to the Piraha (a small Amazon tribe), his analysis of the tribe’s unique language and linguistic structure, and his subsequent “deconversion.” There weren’t a TON of boring linguistic details – just a little too much academic theory for me. I thought I was going to read a travelogue/ethnography with a sprinkle of linguistic details. What I got was approximately half that, and half critical theory. But that’s okay.</p>
53+
54+
55+
56+
57+
58+
59+
60+
61+
62+
63+
64+
<p>I recently finished <em>Don’t Sleep, There are Snakes: Life and Language in the Amazonian Jungle</em>, an autobiographical account of <a href="https://en.wikipedia.org/wiki/Daniel_Everett">Daniel Everett</a>’s time as a Christian missionary to the Piraha (a small Amazon tribe), his analysis of the tribe’s unique language and linguistic structure, and his subsequent “deconversion.” There weren’t a TON of boring linguistic details – just a little too much academic theory for me. I thought I was going to read a travelogue/ethnography with a sprinkle of linguistic details. What I got was approximately half that, and half critical theory. But that’s okay.</p>
5465

5566
<p>Overall, I liked the book. I found some of linguistic theory pretty interesting, as I know very little about linguistics. In particular, Everett’s argument that culture influences language was cool – for example, the Piraha people culturally value the immediacy of experience, which practically means that they don’t have origin stories or creation myths, and that it’s linguistically hard for them to talk about things they haven’t directly experienced. This is in direct conflict to the theories of <a href="https://en.wikipedia.org/wiki/Noam_Chomsky">Noam Chomsky</a> (“the father of modern linguistics”), which make an argument about how human grammar (or something like that) is more of an innate ability than a culturally influenced thing. Honestly though, I was more interested in the ethnographic details of the tribe and how they live, and it was sometimes hard to get through the really in-the-weeds linguistic details. (Which seemed to take up more than half of the book!)</p>
5667

@@ -69,7 +80,7 @@ <h1 class="post-title p-name">Don’t sleep, there are tons of boring linguistic
6980
<script data-goatcounter="https://dlog.goatcounter.com/count" async="" src="//gc.zgo.at/count.js"></script>
7081

7182

72-
</div>
83+
</div>
7384
</article>
7485
</div>
7586
</main><footer class="site-footer h-card">

0 commit comments

Comments
 (0)