-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: typographic fixes due to typos check
- Loading branch information
1 parent
76674f4
commit 3ab9037
Showing
17 changed files
with
159 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Binary file added
BIN
+36.7 KB
content/blog/2022/centering-content-in-markdown/nicely-centred-badges.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.