Skip to content

Commit efa5044

Browse files
authored
Merge pull request #62 from de-soot/main
Edited blog posts
2 parents 44ca257 + 7284d4c commit efa5044

9 files changed

+170
-116
lines changed

_posts/2024-05-24-giscus-comments.md

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
---
22
layout: post
3-
title: Comments on Github Pages with Giscus
3+
title: Comments on Github Pages with giscus
44
date: 2024-05-24
55
categories: comments, giscus, github pages, github discussions, static websites
66
permalink: /giscus-comments
77
---
88

9-
I added a commenting feature for the blog using [giscus][giscus]. Basically, it uses [Github Discussions][discussions-docs] to store comments instead of storing it in its own database on the web server. Since this website is hosted on [Github Pages][pages-docs] and Pages only supports static websites, it cannot host its own databases to store things such as comments.
9+
I added a commenting feature for the blog using [giscus][giscus]. Basically, it uses [Github Discussions][discussions-docs] to store comments instead of storing it in its own database on the web server. Since this website is hosted on [Github Pages][pages-docs] and Pages only supports static websites, it cannot host its own databases to store things such as comments. This guide explains how to add giscus comments to statically-hosted websites, and some quirks and caveats with using Github Discussions as a database for your comments.
1010

1111
# Try it
1212

13-
You can test it out yourself in the comments on blog post below by signing into your github account and commenting, or you can comment on the repository's Github Discussions directly and it will show up on the comments section on the website similarly.
13+
You can test it out yourself on this blog post in the comments below by signing into your Github account and commenting, or you can comment on the repository's Github Discussions directly and it will show up on the comments section on the website similarly.
1414

1515
# Add it to your own Github Pages website
1616

@@ -20,8 +20,6 @@ You can test it out yourself in the comments on blog post below by signing into
2020

2121
3) After you have done so, you can simply copy and paste it into your webpage!
2222

23-
---
24-
2523
# Note
2624

2725
Giscus finds and links the comments to the Github Discussions by searching through and matching URLs, path names, titles, and other such metadata. If you try to change a page's title without editing the associated Github Discussion accordingly, it may lead to giscus not being able to find and link it to the Github Discussion (this is especially noticible if you set the `<script>`'s `data-strict` attribute value to `"1"`), and hence Giscus will create a new Github Discussion.

_posts/2024-09-07-dark-mode.md

+13-11
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
---
22
layout: post
3-
title: Dark Mode with CSS @media Queries
3+
title: Dark Mode without Javascript
44
date: 2024-09-07
5-
categories: dark mode, dark theme, night mode, night theme, colour scheme, jekyll, css, github pages, static websites
5+
categories: dark mode, dark theme, night mode, night theme, colour scheme, jekyll, css, github pages, static site generators, system default
66
permalink: /dark-mode
77
---
88

9+
This guide explains why and how to easily make a dark theme for your website using CSS `@media` queries.
10+
11+
Alternative title: System default theme for websites
12+
913
# Why Dark Mode
1014

1115
For users visiting a website in a dark room at night, it would be less straining for their eyes if the webpage was displayed in a darker colour to match the environment, which is what [dark mode][dark-mode] does.
@@ -19,7 +23,7 @@ From [MDN Web Docs][mdn]:
1923
2024
## For Non-Static-Site-Generator Websites
2125

22-
There also exists a [video guide by Eric Murphy on Youtube][yt-vid] if you prefer to follow along with a video.
26+
There is also a [video guide by Eric Murphy on Youtube][yt-vid] if you prefer to follow along with a video.
2327

2428
### External Style Sheet
2529

@@ -75,11 +79,11 @@ You can also type out your CSS code in between `<style>` tags if you prefer ever
7579
</html>
7680
```
7781

78-
## For Static-Site-Generator Websites
82+
## For Static Site Generator Websites
7983

80-
It is a little bit less straightforward to do this with a static site generator like Jekyll (which has native support with Github Pages and is what this website uses) or Hugo as you have to override the theme's CSS style sheet.
84+
It is a little bit less straightforward to do this with static site generators like Jekyll (which is what this website uses) or Hugo, as you have to override the theme's CSS style sheet.
8185

82-
There is a [blog post by Tom Kadwill on how to override your CSS styles in Jekyll][css-blog] you can follow to create your SCSS file and after which you should get something that resembles this:
86+
There is a [blog post by Tom Kadwill on how to override your CSS styles in Jekyll][css-blog] you can follow to create your SCSS file, and after which you should get something resembling this:
8387

8488
```css
8589
---
@@ -104,7 +108,7 @@ And you should get something like this after adding the dark mode code.
104108
}
105109
```
106110

107-
For other static-site-generator websites, you can refer to the official documentation found online for information on how to override your theme's CSS.
111+
For other static site generator websites, you can refer to the official documentation found online for information on how to override your theme's style-sheet.
108112

109113
# Configure Giscus Theme
110114

@@ -124,11 +128,9 @@ To set `giscus` comments to match the website if you have done the CSS `@media`
124128

125129
# Why Not Use a Toggleable Button Instead
126130

127-
Rather than defaulting to light or dark mode and having a separate button for the user to manually switch to their preferred theme, it might be better to automatically default to what they already set their browser's preferred theme to.
128-
129-
This is so they do not get flashbanged by their monitors at night if your website defaults to light theme and they open their browser to your website for the first time, if they did not toggle it to dark mode the last time they visited, or if your website does not store cookies about their previously toggled theme.
131+
Most likely those who prefer only using one theme will set it in their browser settings, so it would be redundant to have them click another button to toggle the theme on a website.
130132

131-
You can also include the button to toggle themes on the website alongside defaulting it if you want, but I find this an unnecessary use of [Javascript][js].
133+
Rather than defaulting to light or dark mode and having a separate button for the user to manually switch to their preferred theme, it might be better to automatically switch to their system default or preferred browser theme.
132134

133135
# Conclusion
134136

_posts/2024-09-07-justify-text.md

+35-17
Original file line numberDiff line numberDiff line change
@@ -2,47 +2,64 @@
22
layout: post
33
title: Justify and Hyphenate Text on Websites using CSS
44
date: 2024-09-07
5-
categories: justify, text-align, jekyll, css
5+
categories: justify, text-align, jekyll, css, static site generator
66
permalink: /justify-text
77
---
88

9-
You may have noticed while reading my blog posts that the way the text are aligned are a little different from the usual way the ones from other websites are --- that they always align as blocks of text no matter how you change your browser window's size. This is because I have justified the text on my website using CSS.
9+
This blog guide goes into why and how to justify and hyphenate text on your website without Javascript.
1010

11-
# How to Justify
11+
# For Static-Site-Generator Websites
12+
13+
It is a little bit less straightforward to do this with static site generators like Jekyll (which is what this website uses) or Hugo, you will have to override the theme's CSS style sheet.
1214

13-
It is actually pretty simple --- to justify your body text, just add this to your CSS style sheet:
15+
There is a [blog post by Tom Kadwill on how to override your CSS styles in Jekyll][css-blog] you can follow to create your SCSS file, and after which you should get something resembling this:
1416

1517
```css
16-
body {
17-
text-align: justify;
18-
}
18+
---
19+
---
20+
21+
@import "minima"; /* replace minima inside the quotes with your Jekyll theme */
1922
```
2023

21-
This will justify your text so it all aligns neatly without jagged edges.
24+
After this, you can follow all the steps below the same way as it would be done if you were using CSS in a non-static-site-generator instead of SCSS in a static site generator.
2225

23-
# How to Hyphenate
26+
# Why Justify Text
2427

25-
Although there is a way to do this with Javascript using [Hyphenopoly.js][hyphenopoly], hyphenation is a built-in functionality in CSS and it is widely supported by browsers.
28+
It is more of an aesthetic preference than anything. This jaggedness generally does not bother people that much because they have grown used to the popular left-aligned style of text on the web and probably do not know justification even exists on the web, only on printed books and newspapers. But it just looks better to me when all lines are the same length and the right side of text is not jagged. Justifcation is a way of acheiving that aesthetic goal without cutting words off abruptly.
2629

27-
To add hyphenation to your body text, simply add the `hyphens` property to your body section in your CSS style sheet and set it to `auto`, like so:
30+
# How to Justify
31+
32+
It is actually pretty simple. To justify your body text, just add this to your CSS style sheet:
2833

2934
```css
3035
body {
31-
hyphens: auto
36+
text-align: justify;
3237
}
3338
```
3439

3540
# Why Hyphenate
3641

37-
So now your text wraps words using hyphens, but why do we need to use hyphens that ruin the perfect edges that justifying makes?
38-
39-
Text justification can make your paragraphs look tidier, but this has the potential side-effect of awkwardly stretching out the whitespace between words --- which can create and worsen an undesirable effect commonly referred to as 'rivers of white', which is known to trip up dyslexic readers and decrease accessibility.
42+
Text justification can make your paragraphs look tidier, but it has the side-effect of awkwardly stretching out the whitespace between words, which can create and worsen an undesirable effect commonly referred to as 'rivers of white'. This effect is known to make text harder for dyslexic readers to read, decreasing accessibility.
4043

4144
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/d/d2/Typographic_river_marking.svg/1280px-Typographic_river_marking.svg.png" alt="Image from Wikipedia with visual marking around an example of a 'rivers of white' effect.">
4245

43-
This is also a common reason as to why justification is generally [not][applewood] [recommended][max] for text output on the web.
46+
This is why justification is generally [not][applewood] [recommended][max] for text output on the web.
47+
48+
By hyphenating, even though it does not solve the problem completely, it will reduce this effect significantly while keeping text not jagged.
4449

45-
By hyphenating, even though it does not solve it completely, it will reduce the effect dramatically.
50+
Hyphenating text will cut off some words at the end of lines (indicated by an auto-inserted hyphen), but it will do it with an algorithm that tries to make it seamless.
51+
52+
# How to Hyphenate
53+
54+
Although there is a way to hyphenate with Javascript using [Hyphenopoly.js][hyphenopoly], there already is a built-in functionality in CSS to do this and it is [widely supported by browsers](https://developer.mozilla.org/en-US/docs/Web/CSS/hyphens).
55+
56+
To add hyphenation to your body text, simply add the `hyphens` property to your body section in your CSS style sheet and set it to `auto`, like so:
57+
58+
```css
59+
body {
60+
hyphens: auto
61+
}
62+
```
4663

4764
# Other Blogs That Justify
4865

@@ -66,6 +83,7 @@ f you found this blog post useful, leave a comment down below! Also read how to
6683
[applewood]: https://applewoodinteractive.com/accessibility/rivers-of-white-why-you-should-never-justify-your-text
6784
[pubdeliver]: https://publicdelivery.org
6885
[hyphenopoly]: https://mnater.github.io/Hyphenopoly
86+
[css-blog]: https://tomkadwill.com/2017/12/16/how-to-override-css-styles-in-jekyll
6987

7088
<script src="https://giscus.app/client.js"
7189
data-repo="de-soot/de-soot.github.io"

_posts/2025-02-20-groff-apa.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ categories: groff, ms, refer, macro, tmac, APA, style guide, pdf
66
permalink: /groff-apa
77
---
88

9+
This guide explains why and how I used groff with the ms and refer macros to write my college essay in Neovim.
10+
911
# Table of Contents <a name=tableofcontents></a>
1012

1113
1. [Table of Contents](/groff-apa#tableofcontents)
@@ -457,7 +459,7 @@ Below is a list explaining what each of the optional arguments mean:
457459

458460
# Conclusion <a name=conclusion></a>
459461

460-
If you found this helpful in any way or have any questions, feel free to leave a comment below.
462+
If you found this helpful in any way or have any questions, feel free to leave a comment below. Also read my [previous guide](/justify-text) on how I justify and hyphenate the text on this website.
461463

462464
<script src="https://giscus.app/client.js"
463465
data-repo="de-soot/de-soot.github.io"

_site/dark-mode.html

+19-17
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@
33
<meta charset="utf-8">
44
<meta http-equiv="X-UA-Compatible" content="IE=edge">
55
<meta name="viewport" content="width=device-width, initial-scale=1"><!-- Begin Jekyll SEO tag v2.8.0 -->
6-
<title>Dark Mode with CSS @media Queries | de_soot</title>
6+
<title>Dark Mode without Javascript | de_soot</title>
77
<meta name="generator" content="Jekyll v3.10.0" />
8-
<meta property="og:title" content="Dark Mode with CSS @media Queries" />
8+
<meta property="og:title" content="Dark Mode without Javascript" />
99
<meta property="og:locale" content="en_US" />
10-
<meta name="description" content="Why Dark Mode" />
11-
<meta property="og:description" content="Why Dark Mode" />
10+
<meta name="description" content="This guide explains why and how to easily make a dark theme for your website using CSS @media queries." />
11+
<meta property="og:description" content="This guide explains why and how to easily make a dark theme for your website using CSS @media queries." />
1212
<link rel="canonical" href="http://localhost:4000/dark-mode" />
1313
<meta property="og:url" content="http://localhost:4000/dark-mode" />
1414
<meta property="og:site_name" content="de_soot" />
1515
<meta property="og:type" content="article" />
1616
<meta property="article:published_time" content="2024-09-07T00:00:00+08:00" />
1717
<meta name="twitter:card" content="summary" />
18-
<meta property="twitter:title" content="Dark Mode with CSS @media Queries" />
18+
<meta property="twitter:title" content="Dark Mode without Javascript" />
1919
<script type="application/ld+json">
20-
{"@context":"https://schema.org","@type":"BlogPosting","dateModified":"2024-09-07T00:00:00+08:00","datePublished":"2024-09-07T00:00:00+08:00","description":"Why Dark Mode","headline":"Dark Mode with CSS @media Queries","mainEntityOfPage":{"@type":"WebPage","@id":"http://localhost:4000/dark-mode"},"url":"http://localhost:4000/dark-mode"}</script>
20+
{"@context":"https://schema.org","@type":"BlogPosting","dateModified":"2024-09-07T00:00:00+08:00","datePublished":"2024-09-07T00:00:00+08:00","description":"This guide explains why and how to easily make a dark theme for your website using CSS @media queries.","headline":"Dark Mode without Javascript","mainEntityOfPage":{"@type":"WebPage","@id":"http://localhost:4000/dark-mode"},"url":"http://localhost:4000/dark-mode"}</script>
2121
<!-- End Jekyll SEO tag -->
2222
<link rel="stylesheet" href="/assets/main.css"><link type="application/atom+xml" rel="alternate" href="http://localhost:4000/feed.xml" title="de_soot" /></head>
2323
<body><header class="site-header" role="banner">
@@ -40,14 +40,18 @@
4040
<article class="post h-entry" itemscope itemtype="http://schema.org/BlogPosting">
4141

4242
<header class="post-header">
43-
<h1 class="post-title p-name" itemprop="name headline">Dark Mode with CSS @media Queries</h1>
43+
<h1 class="post-title p-name" itemprop="name headline">Dark Mode without Javascript</h1>
4444
<p class="post-meta">
4545
<time class="dt-published" datetime="2024-09-07T00:00:00+08:00" itemprop="datePublished">Sep 7, 2024
4646
</time></p>
4747
</header>
4848

4949
<div class="post-content e-content" itemprop="articleBody">
50-
<h1 id="why-dark-mode">Why Dark Mode</h1>
50+
<p>This guide explains why and how to easily make a dark theme for your website using CSS <code class="language-plaintext highlighter-rouge">@media</code> queries.</p>
51+
52+
<p>Alternative title: System default theme for websites</p>
53+
54+
<h1 id="why-dark-mode">Why Dark Mode</h1>
5155

5256
<p>For users visiting a website in a dark room at night, it would be less straining for their eyes if the webpage was displayed in a darker colour to match the environment, which is what <a href="https://en.wikipedia.org/wiki/Light-on-dark_color_scheme">dark mode</a> does.</p>
5357

@@ -62,7 +66,7 @@ <h1 id="how-to-do-it">How to do it</h1>
6266

6367
<h2 id="for-non-static-site-generator-websites">For Non-Static-Site-Generator Websites</h2>
6468

65-
<p>There also exists a <a href="https://youtu.be/g85LQVp0hGM">video guide by Eric Murphy on Youtube</a> if you prefer to follow along with a video.</p>
69+
<p>There is also a <a href="https://youtu.be/g85LQVp0hGM">video guide by Eric Murphy on Youtube</a> if you prefer to follow along with a video.</p>
6670

6771
<h3 id="external-style-sheet">External Style Sheet</h3>
6872

@@ -115,11 +119,11 @@ <h3 id="with-the-style-html-tag">With the &lt;style&gt; HTML tag</h3>
115119
<span class="nt">&lt;/html&gt;</span>
116120
</code></pre></div></div>
117121

118-
<h2 id="for-static-site-generator-websites">For Static-Site-Generator Websites</h2>
122+
<h2 id="for-static-site-generator-websites">For Static Site Generator Websites</h2>
119123

120-
<p>It is a little bit less straightforward to do this with a static site generator like Jekyll (which has native support with Github Pages and is what this website uses) or Hugo as you have to override the theme’s CSS style sheet.</p>
124+
<p>It is a little bit less straightforward to do this with static site generators like Jekyll (which is what this website uses) or Hugo, as you have to override the theme’s CSS style sheet.</p>
121125

122-
<p>There is a <a href="https://tomkadwill.com/2017/12/16/how-to-override-css-styles-in-jekyll">blog post by Tom Kadwill on how to override your CSS styles in Jekyll</a> you can follow to create your SCSS file and after which you should get something that resembles this:</p>
126+
<p>There is a <a href="https://tomkadwill.com/2017/12/16/how-to-override-css-styles-in-jekyll">blog post by Tom Kadwill on how to override your CSS styles in Jekyll</a> you can follow to create your SCSS file, and after which you should get something resembling this:</p>
123127

124128
<div class="language-css highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nt">---</span>
125129
<span class="nt">---</span>
@@ -142,7 +146,7 @@ <h2 id="for-static-site-generator-websites">For Static-Site-Generator Websites</
142146
<span class="p">}</span>
143147
</code></pre></div></div>
144148

145-
<p>For other static-site-generator websites, you can refer to the official documentation found online for information on how to override your theme’s CSS.</p>
149+
<p>For other static site generator websites, you can refer to the official documentation found online for information on how to override your theme’s style-sheet.</p>
146150

147151
<h1 id="configure-giscus-theme">Configure Giscus Theme</h1>
148152

@@ -161,11 +165,9 @@ <h1 id="configure-giscus-theme">Configure Giscus Theme</h1>
161165

162166
<h1 id="why-not-use-a-toggleable-button-instead">Why Not Use a Toggleable Button Instead</h1>
163167

164-
<p>Rather than defaulting to light or dark mode and having a separate button for the user to manually switch to their preferred theme, it might be better to automatically default to what they already set their browser’s preferred theme to.</p>
165-
166-
<p>This is so they do not get flashbanged by their monitors at night if your website defaults to light theme and they open their browser to your website for the first time, if they did not toggle it to dark mode the last time they visited, or if your website does not store cookies about their previously toggled theme.</p>
168+
<p>Most likely those who prefer only using one theme will set it in their browser settings, so it would be redundant to have them click another button to toggle the theme on a website.</p>
167169

168-
<p>You can also include the button to toggle themes on the website alongside defaulting it if you want, but I find this an unnecessary use of <a href="https://www.javascript.com">Javascript</a>.</p>
170+
<p>Rather than defaulting to light or dark mode and having a separate button for the user to manually switch to their preferred theme, it might be better to automatically switch to their system default or preferred browser theme.</p>
169171

170172
<h1 id="conclusion">Conclusion</h1>
171173

0 commit comments

Comments
 (0)