Skip to content

Commit

Permalink
fix: typographic fixes due to typos check
Browse files Browse the repository at this point in the history
  • Loading branch information
davidsneighbour committed Aug 28, 2022
1 parent 76674f4 commit 3ab9037
Show file tree
Hide file tree
Showing 17 changed files with 159 additions and 49 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/check-typos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Test GitHub Action
on: [pull_request]

jobs:
run:
name: Spell Check with Typos
runs-on: ubuntu-latest
steps:
- name: Checkout Actions Repository
uses: actions/checkout@v2

- name: Check spelling of file.txt
uses: crate-ci/typos@master
with:
files: ./file.txt

- name: Use custom config file
uses: crate-ci/typos@master
with:
files: ./file.txt
config: ./myconfig.toml

- name: Ignore implicit configuration file
uses: crate-ci/typos@master
with:
files: ./file.txt
isolated: true
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ repos:
exclude: ^(_vendor)
args: [--markdown-linebreak-ext=md]

- repo: 'https://github.com/crate-ci/typos'
rev: v1.8.1
hooks:
- id: typos
args: ['--config', './tests/config/typos.toml', './content/']
files: ^content|i18n
# - repo: 'https://github.com/crate-ci/typos'
# rev: v1.8.1
# hooks:
# - id: typos
# args: ['--config', './config/local/typos.toml', './content/']
# files: ^content|i18n

- repo: 'https://github.com/PrincetonUniversity/blocklint'
rev: v0.2.3
Expand Down
21 changes: 21 additions & 0 deletions config/_local/_typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[default]
locale = "en-gb"

[default.extend-identifiers]
monetization = "monetization"
eq = "eq"
color = "color"

[default.extend-words]
acer = "acer"
idea = "idea"
commitish = "commitish"
organizations = "organizations"
cesar = "cesar" # it's a name :)
updraft = "updraft"
armor = "armor" # GPG2 parameter
color = "color"

[type.json]
extend-glob = ["*.json"]
check-file = false
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
85 changes: 85 additions & 0 deletions content/blog/2022/centering-content-in-markdown/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
title: Centring Content in Markdown
date: 2022-08-18T00:02:45+07:00
lastmod: 2022-08-28T21:10:00+07:00

description: ""
summary: ""
draft: true

resources:
- title: Photo by [Luis Villasmil](https://unsplash.com/@villxsmil) via
[Unsplash](https://unsplash.com/)
src: header.jpg
- src: nicely-centred-badges.png

categories:
- category1

tags:
- tag1
- tag2
- tag3

keywords:
- keyword1
- keyword2
- keyword3

unsplash:
imageid: jPpHpgWNCKs
---

Every now and then I come upon use-cases where Markdown seems to have a huge blind spot. And yeah, sure, you will agree with me, that Markdown is great and unfallable and super awesome convenient.

Right?

Well, then, how do you centr content in Markdown?

I'll take my answer off the air... ;)

The CommonMark specification has a nice fallback, called [HTML Blocks](https://spec.commonmark.org/0.30/#html-blocks) for anything the markdown syntax can't add, which is basically HTML tags in Markdown.

While that might be a good solution for many applications using Markdown this is not the case with GoHugo, because it declares these tags as HTML (due to sanitisation in the name of safety) and either filters them out[^1] or has the user set an insecure configuration like the following:

```toml
[markup.goldmark.renderer]
# and everyone sleeps well tonight.
unsafe= true
```

Long story short: Markdown is not a design language, it's a content mark-up language. In end we will have to use more or less usable "hacks" to make our content centr.

Much of my ranting is in regards to GoHugo, mostly because other SSGs might interpret CommonMark HTML Blocks better or just don't filter HTML tags out when Markdown is parsed.

Following are some methods to centr your content in a more or less usable way, either for you as developer of a site or your users as content creators.

## Method 1: HTML and `unsafe=true` (please don't)

## Method 2: A shortcode

## Method 3: An inline class for block level Markup

## Method 4: A table, really

This last method is more or less my hack for GitHub, where, in a README.md, I needed to add a bunch of buttons and wanted them looking nicely centred. Methods 1 to 3 didn't work, so I fell back to a weird hack: Adding a Markdown table and centring the "column" (the only cell in the table) via `:---:`.

Have a look:

```markdown
| headline |
| :---: |
| centred text... |
```
This results in a nice table, looking like this:

| headline |
| :---: |
| centred text centred text centred text centred text centred text centred text centred text centred text centred text centred centred text centred text centred text centred text centred text centred text centred text centred text centred text centred text centred text centred text |

The headline cell (a table header) seems to be required, so you could add a nice title there or a simple ` `. You won't be able to get rid of the lines around the table in Github, but I think it looks not too bad in the end.

![](/blog/2022/centring-content-in-markdown/nicely-centred-badges.png)


[^1]: resulting in those nice `<!-- raw HTML omitted -->` markers in the HTML
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions content/blog/2022/gitignore-for-gohugo/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ tags:
- gitignore
- developers
- 100DaysToOffload
lastmod: 2022-08-22T23:52:02+07:00
lastmod: 2022-08-28T21:14:08+07:00
slug: gitignore-gohugo
aliases:
- /blog/2021/gitignore-for-gohugo/
Expand Down Expand Up @@ -37,7 +37,7 @@ Let me tell you why:

**/assets/jsconfig.json** is a file that is automatically created by Hugo when running it's pipes. It contains local path information that depends on your local workstation. Your home directory might not be in the same directory seen from root on every computer. So leave this file out of the loop. Recreating it will not take much time.

**hugo.log** is my preferred logfile name. If you use `--log` and `--logFile` parameters for your Hugo server and build commands, then you will have a file that keeps a log of everthing your Hugo process has to tell you. Don't add these logs to your repository. The name might change of course based on your preferences.
**hugo.log** is my preferred logfile name. If you use `--log` and `--logFile` parameters for your Hugo server and build commands, then you will have a file that keeps a log of everything your Hugo process has to tell you. Don't add these logs to your repository. The name might change of course based on your preferences.

**hugo_stats.json** is created if you run Hugo with the `build > writeStats` configuration enabled. It will list used classes, id's and tags and is a tool to help for instance PurgeCSS to work. Don't put that into your repository, because it will change every time you change something in the layouts folder.

Expand Down
4 changes: 2 additions & 2 deletions content/blog/2022/notes-from-the-laboratory-may/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ tags:
- notes
- self-improvement
- 100DaysToOffload
lastmod: 2022-06-05T20:43:05+07:00
lastmod: 2022-08-28T21:08:32+07:00
---

> I am trying this new "thing" of "reporting" what I was up to in a certain time period this year, and monthly reviews just sound like something normal people would do. So bear with me while I am typing up this report.
Expand All @@ -24,7 +24,7 @@ Slightly delayed comes the May report now:
- **Focus:** Missing.
- **Fixing things:** A lot more than I like to admit.
- **Cleanup:** Closing down nonsense repos and projects. Concentrating on the things I like.
- **kollitsch.dev:** Fixing the color schemes, fixing plenty of stuff under the hood and upgrading to Bootstrap 5.2. I am not sure if I am doing this right.
- **kollitsch.dev:** Fixing the colour schemes, fixing plenty of stuff under the hood and upgrading to Bootstrap 5.2. I am not sure if I am doing this right.
- **Customers:** They are all happy it seems. I am not sure if I am doing this right.
- **Pokki:** I wonder how many months in the future I will look back at this time and think of it as "the good times" before it all ended. I am not sure if I am doing this right.
- **Language Learning:** Continuing with my Golang lessons and wondering if I am doing this right.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ summary: This is one of the posts that spent months in draft (fka ideas) mode. R
thought I might as well add some context to it.
date: 2022-08-14T22:28:21+07:00
publishDate: 2022-08-14T22:28:21+07:00
lastmod: 2022-08-15T0:17:00+07:00
lastmod: 2022-08-28T18:44:23+07:00

resources:
- title: Photo by [Mohammad Rahmani](https://unsplash.com/@afgprogrammer) via
Expand Down Expand Up @@ -65,7 +65,7 @@ This will remove trailing whitespaces on all files, but markdown files (because,
rev: v1.8.1
hooks:
- id: typos
args: ['--config', './tests/config/typos.toml', './content/']
args: ['--config', './config/local/typos.toml', './content/']
files: ^content|i18n
```

Expand Down
2 changes: 1 addition & 1 deletion content/components/hugo-debug/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ The resulting error message will look like this:

`SEVERITY TIMESTAMP [namespaceslug/severity-level] message`

*Note:* GoHugo will print all messages that occure more than once will printed only once. This applies to identical error messages. To work around this (if you wish to for instance notify the user about multiple image transformations not working) you should add an identifier (the image url? the resource id?) to the debugging message.
*Note:* GoHugo will print all messages that occur more than once will printed only once. This applies to identical error messages. To work around this (if you wish to for instance notify the user about multiple image transformations not working) you should add an identifier (the image url? the resource id?) to the debugging message.

*Note2:* Hugo makes only ERROR and WARN levels available, so all `SEVERITY` stamps in the beginning of each log line will be either a red ERROR (from errors and fatals --- 1 to 4) or a yellow WARN for all others (debug to warn --- 5 to 10).

Expand Down
2 changes: 1 addition & 1 deletion content/components/hugo-feeds/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ hugo mod get -u #

`hugo-feeds` uses a cautious approach at configuring the output of the feeds. Where GoHugo's internal RSS template prints _all_ available pages without a configured limit, `hugo-feeds` will load only the 10 latest pages/posts, but you can configure at your pleasure.

If either `rssLimit` or `services.rss.limit` is defined and NOT overridden by any other configuration then these values will be choosen for RSS. Limits for specific feed formats can be configured explicitly.
If either `rssLimit` or `services.rss.limit` is defined and NOT overridden by any other configuration then these values will be chosen for RSS. Limits for specific feed formats can be configured explicitly.

```toml
[dnb]
Expand Down
2 changes: 1 addition & 1 deletion content/components/hugo-internals/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ This component uses [hugo-robots](https://github.com/davidsneighbour/hugo-robots
enableRobotsTXT = true
```

Read more about detailled setup options at [the documentation](https://kollitsch.dev/components/hugo-robots/).
Read more about detailed setup options at [the documentation](https://kollitsch.dev/components/hugo-robots/).

## [hugo-sitemap](https://github.com/davidsneighbour/hugo-sitemap) --- Add a configurable sitemap

Expand Down
4 changes: 2 additions & 2 deletions content/components/hugo-pictures/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Pictures
linkTitle: "hugo-pictures"
description: "This component for GoHugo adds partials and shortcodes to handle images on your website. It offers responsive image formats and optimized loading based on current browser abilities."
description: "This component for GoHugo adds partials and shortcodes to handle images on your website. It offers responsive image formats and optimisgit ed loading based on current browser abilities."

date: 2022-08-24T19:47:25+07:00
publishDate: "2022-08-24T19:47:25+07:00"
Expand All @@ -26,7 +26,7 @@ component:
user: davidsneighbour
---

This component for [GoHugo](https://gohugo.io/) adds partials and shortcodes to handle images on your website. It offers responsive image formats and optimized loading based on current browser abilities.
This component for [GoHugo](https://gohugo.io/) adds partials and shortcodes to handle images on your website. It offers responsive image formats and optimised loading based on current browser abilities.

{{< notice type="danger" heading="Work in progress!" >}}
Check back for better documentation and more features. The following documentation is, as long as this note is here, only partial and might be missing important points. If you have any questions, or ideas, please [add an issue to the issue tracker](https://github.com/davidsneighbour/hugo-pictures/issues).
Expand Down
2 changes: 1 addition & 1 deletion content/components/hugo-robots/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ component:
list: true
---

This component for [GoHugo](https://gohugo.io/) adds a customizable robots.txt to your website.
This component for [GoHugo](https://gohugo.io/) adds a customisable robots.txt to your website.

{{< component-box >}}

Expand Down
2 changes: 1 addition & 1 deletion content/components/hugo-sitemap/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ enabled = true

Without any configuration the default is true, meaning to include any page into the sitemap.

__DEPRECATED__: Frontmatter `robotsdisallow` from earlier `hugo-robots` versions did result in the page being ommited from the sitemap. This is deprecated, but currently still supported. The module will echo a note on CLI about this.
__DEPRECATED__: Frontmatter `robotsdisallow` from earlier `hugo-robots` versions did result in the page being omitted from the sitemap. This is deprecated, but currently still supported. The module will echo a note on CLI about this.

## HTML Sitemap

Expand Down
Loading

0 comments on commit 3ab9037

Please sign in to comment.