From 3dadf655b35717fe9898dfa30a14ea21590f758e Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Sat, 14 Sep 2024 03:10:34 +0900 Subject: [PATCH 1/4] Introduce markdownlint-cli2 --- .github/dependabot.yml | 4 ++++ .github/workflows/lint.yml | 9 +++++++++ .vscode/extensions.json | 1 + Makefile | 1 + flake.nix | 2 ++ 5 files changed, 17 insertions(+) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index fe331d825..a631a239d 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -8,6 +8,10 @@ updates: nix: patterns: - 'DeterminateSystems*' + ignore: + # They do not support specifying a version in the latest action. Therefore, we need to pin the version for nixpkgs compatibility. + # See https://github.com/DavidAnson/markdownlint-cli2-action/issues/94 for detail + - dependency-name: 'DavidAnson/markdownlint-cli2-action' - package-ecosystem: 'gomod' directory: '/' schedule: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 1f76bbe6f..fe1746b08 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -25,3 +25,12 @@ jobs: dprint-version: 0.45.0 - name: Debug print for deprint target paths run: dprint output-file-paths + + markdownlint: + timeout-minutes: 15 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: DavidAnson/markdownlint-cli2-action@3aaa38e446fbd2c288af4291aa0f55d64651050f # v12 + with: + globs: '**/*.md' diff --git a/.vscode/extensions.json b/.vscode/extensions.json index e3e1ebbc7..4736e9f0f 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -6,5 +6,6 @@ "tekumara.typos-vscode", "dprint.dprint", "jnoortheen.nix-ide", + "davidanson.vscode-markdownlint" ] } diff --git a/Makefile b/Makefile index 936d7f253..a0e3a984d 100644 --- a/Makefile +++ b/Makefile @@ -27,3 +27,4 @@ deps: nil --version peco --version vim --version | sed -n '1p' + markdownlint-cli2 --version | grep 'markdownlint v' diff --git a/flake.nix b/flake.nix index 19b1f9086..685a0659a 100644 --- a/flake.nix +++ b/flake.nix @@ -40,6 +40,8 @@ hugo go_1_22 dart-sass + + markdownlint-cli2 ]; }; From b3ffaff9c0dd4add24b00fae4fe59cb025f20b79 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Sat, 14 Sep 2024 03:24:03 +0900 Subject: [PATCH 2/4] Opt-out several lint errors --- .markdownlint-cli2.yaml | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .markdownlint-cli2.yaml diff --git a/.markdownlint-cli2.yaml b/.markdownlint-cli2.yaml new file mode 100644 index 000000000..b3a0f23c0 --- /dev/null +++ b/.markdownlint-cli2.yaml @@ -0,0 +1,7 @@ +config: + default: true + MD010: false # no-hard-tabs + MD014: false # commands-show-output + MD013: false # line-length + MD026: false # no-trailing-punctuation + MD033: false # no-inline-html From c55274733d1ec07630c005296407b7892008f29a Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Sat, 14 Sep 2024 03:25:18 +0900 Subject: [PATCH 3/4] Enable markdownlint only for fenced-code-language --- .markdownlint-cli2.yaml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.markdownlint-cli2.yaml b/.markdownlint-cli2.yaml index b3a0f23c0..0734c3472 100644 --- a/.markdownlint-cli2.yaml +++ b/.markdownlint-cli2.yaml @@ -1,7 +1,3 @@ config: - default: true - MD010: false # no-hard-tabs - MD014: false # commands-show-output - MD013: false # line-length - MD026: false # no-trailing-punctuation - MD033: false # no-inline-html + default: false + MD040: true # fenced-code-language From 1274ff810f9a2e5e43961fe53a1bee77d3cbf040 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Sat, 14 Sep 2024 03:35:26 +0900 Subject: [PATCH 4/4] Apply missing language specifier in fenced code blocks --- content/posts/arch-windows-multiboot-tips.md | 4 ++-- .../posts/decorate-git-command-in-alpine.md | 4 ++-- content/posts/dokusho-meter.md | 18 +++++++++++++----- content/posts/droidkaigi-2018-3.md | 2 +- ...n-is-disabled-if-no-activity-in-the-repo.md | 2 +- content/posts/golangtokyo-14.md | 2 +- content/posts/golangtokyo-16.md | 8 ++++---- content/posts/golangtokyo-6.md | 6 +++--- content/posts/jp-input-on-gnome-app.md | 4 ++-- content/posts/raspi-livestream-web.md | 2 +- content/posts/usb-wifi-dongle.md | 4 ++-- content/posts/use-uim-mozc.md | 2 +- content/posts/wsl2-uses-cpu-100-percent.md | 2 +- 13 files changed, 34 insertions(+), 26 deletions(-) diff --git a/content/posts/arch-windows-multiboot-tips.md b/content/posts/arch-windows-multiboot-tips.md index 737ab9d3b..2116083db 100644 --- a/content/posts/arch-windows-multiboot-tips.md +++ b/content/posts/arch-windows-multiboot-tips.md @@ -39,7 +39,7 @@ Windows8.1に対してWindows Updateしたところ、何だかわからない -- genfstab とかそういったことをこまごま行う。 -- ブートローダのインストール。ブートローダにはgummibootを採用した。 -``` +```bash mount /dev/sda2 /boot/EFI cd /boot/EFI gummiboot install @@ -62,7 +62,7 @@ Vaioのせいなのか、Windowsのせいなのか。。 -- まず、EFIのパーティションをマウントする。 -``` +```bash mount /dev/sda2 /mnt/boot/EFI ``` diff --git a/content/posts/decorate-git-command-in-alpine.md b/content/posts/decorate-git-command-in-alpine.md index 506b211c1..0206ce42b 100644 --- a/content/posts/decorate-git-command-in-alpine.md +++ b/content/posts/decorate-git-command-in-alpine.md @@ -22,7 +22,7 @@ Alpine Linux で git を使うと、色々気に食わないことが起こる less を入れる。 -``` +```bash sudo apk add less ``` @@ -35,7 +35,7 @@ Refs: https://wiki.alpinelinux.org/wiki/Alpine_Linux:FAQ#How_to_enable.2Ffix_col 曰く、 -``` +```plaintext The problem is not in git itself or terminal, but in the less command. Busybox’s less doesn’t support -r (--raw-control-chars) and -R (--RAW-CONTROL-CHARS) options. The simplest (yet not ideal) solution is to install GNU less: apk add less diff --git a/content/posts/dokusho-meter.md b/content/posts/dokusho-meter.md index 8bea7d634..f525757f8 100644 --- a/content/posts/dokusho-meter.md +++ b/content/posts/dokusho-meter.md @@ -33,7 +33,7 @@ Octopressに読書メーターのブログパーツを追加する方法。 中身は上記ブログパーツの内容をコピペしたものだが。 ブログパーツとして「最近読んだ本」をチョイス。 -``` +```html
{人の名前}の最近読んだ本
@@ -43,10 +43,18 @@ Octopressに読書メーターのブログパーツを追加する方法。 _config.ymlのdefault_asidesを変更。読書メーター用HTMLファイルを指定。 -``` -default_asides: [custom/asides/about.html, asides/recent_posts.html, asides/github.html, asides/delicious.html, - asides/pinboard.html, asides/googleplus.html, custom/asides/tag_cloud.html, custom/asides/category_list.html, - custom/asides/dokusho_meter.html] +```yaml +default_asides: [ + custom/asides/about.html, + asides/recent_posts.html, + asides/github.html, + asides/delicious.html, + asides/pinboard.html, + asides/googleplus.html, + custom/asides/tag_cloud.html, + custom/asides/category_list.html, + custom/asides/dokusho_meter.html, +] ``` #### deployしたら完了 diff --git a/content/posts/droidkaigi-2018-3.md b/content/posts/droidkaigi-2018-3.md index fd11789a7..75c9ebc18 100644 --- a/content/posts/droidkaigi-2018-3.md +++ b/content/posts/droidkaigi-2018-3.md @@ -104,7 +104,7 @@ func (t *t) Show(text string) error { ちゃんとどのようなエラーが (4) で吐かれているか補足してみたところ、以下の例外が投げられていた。 -``` +```plaintext java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare() ``` diff --git a/content/posts/github-action-is-disabled-if-no-activity-in-the-repo.md b/content/posts/github-action-is-disabled-if-no-activity-in-the-repo.md index 66713e333..65bdcd783 100644 --- a/content/posts/github-action-is-disabled-if-no-activity-in-the-repo.md +++ b/content/posts/github-action-is-disabled-if-no-activity-in-the-repo.md @@ -11,7 +11,7 @@ GitHub から「更新のないリポジトリで使ってる定期実行 GitHub GitHub 曰く、 -``` +```plaintext Scheduled workflows are disabled automatically after 60 days of repository inactivity ``` diff --git a/content/posts/golangtokyo-14.md b/content/posts/golangtokyo-14.md index 71bcd7414..72a2bbcf3 100644 --- a/content/posts/golangtokyo-14.md +++ b/content/posts/golangtokyo-14.md @@ -33,7 +33,7 @@ goroutine と defer と panic を組み合わせて使う場合に注意すべ たとえば以下のような場合、A 内で張った defer は呼び出されない**場合がある**。 (スライド内では"呼び出されない"と書かれているが、その限りではなさそうな) -``` +```go func A() { defer func(){}() go B() diff --git a/content/posts/golangtokyo-16.md b/content/posts/golangtokyo-16.md index faba6b555..1922b4544 100644 --- a/content/posts/golangtokyo-16.md +++ b/content/posts/golangtokyo-16.md @@ -29,7 +29,7 @@ Go 言語も wasm へのビルド (トランスパイル) を Go 1.11 からサ たとえば以下のいわゆるハローワールド的なコードも wasm 向けにビルドできるようになる。 -``` +```go package main import "fmt" @@ -42,7 +42,7 @@ func main() { wasm 向けのビルドは以下のようなコマンドで行う。 (上記のソースが main.go として存在していると仮定) -``` +```console $ GOOS=js GOARCH=wasm go build -o hello.wasm main.go ``` @@ -53,7 +53,7 @@ GitHub に curl を飛ばしても取得できる。 ビルドと必要なファイルを揃える処理を一式 Makefile で書くと以下のような感じになる。 -``` +```makefile WASM = test.wasm HTML = wasm_exec.html JS = wasm_exec.js @@ -76,7 +76,7 @@ clean: 一式そろうと以下のようになる。 -``` +```console $ ls main.go Makefile server.go test.wasm wasm_exec.html wasm_exec.js ``` diff --git a/content/posts/golangtokyo-6.md b/content/posts/golangtokyo-6.md index 0630a6e32..dab4803de 100644 --- a/content/posts/golangtokyo-6.md +++ b/content/posts/golangtokyo-6.md @@ -38,7 +38,7 @@ https://www.slideshare.net/takuyaueda967/gopher-fest-2017 型にエイリアスが張れるようになるとのこと。 以下のような書き方ができるようになる。 -``` +```go type Applicant = http.Client ``` @@ -49,7 +49,7 @@ type Applicant = http.Client (パターン1) 新しい型を作って順次移行する場合 -``` +```go type Applicant Client ``` @@ -58,7 +58,7 @@ type Applicant Client (パターン2) 埋め込みを使う場合 -``` +```go type Applicant struct { Client } ``` diff --git a/content/posts/jp-input-on-gnome-app.md b/content/posts/jp-input-on-gnome-app.md index 9fa48b2ad..3e518bc78 100644 --- a/content/posts/jp-input-on-gnome-app.md +++ b/content/posts/jp-input-on-gnome-app.md @@ -30,7 +30,7 @@ dconf Editor を開き、以下の設定を確認する。 コマンドラインから確認する場合は以下のように入力する。 -``` +```console $ gsettings get org.gnome.settings-daemon.plugins.xsettings overrides # (期待される出力) {'Gtk/IMModule': <'fcitx'>} ``` @@ -38,7 +38,7 @@ $ gsettings get org.gnome.settings-daemon.plugins.xsettings overrides 入ってなかったら、上記の値をコピペして設定する。 コマンドラインから設定する場合は以下のように入力する。 -``` +```console $ gsettings set org.gnome.settings-daemon.plugins.xsettings overrides "{'Gtk/IMModule':<'fcitx'>}" ``` diff --git a/content/posts/raspi-livestream-web.md b/content/posts/raspi-livestream-web.md index f8697a14a..9fa59dd8d 100644 --- a/content/posts/raspi-livestream-web.md +++ b/content/posts/raspi-livestream-web.md @@ -26,7 +26,7 @@ pacmanであったりyaourtで取得できるmjpg-streamerのパッケージは 下記のような。とりあえずサンプルなので、簡単に。。 書いたHTMLは、任意の場所におく。ここではひとまず、`~/www/index.html`として置いたとする。 -``` +```html

Raspberry Pi

diff --git a/content/posts/usb-wifi-dongle.md b/content/posts/usb-wifi-dongle.md index c56016d9c..e62668e66 100644 --- a/content/posts/usb-wifi-dongle.md +++ b/content/posts/usb-wifi-dongle.md @@ -39,7 +39,7 @@ WN-AC433UM は、idVendor が 04BB、idProduct が 0959 であるが、 os_dep/linux/usb_intf.c に、以下のように追記する。 (注: 妥当か不明だがとりあえず以下の書き換えでうまくいった) -``` +```patch diff --git a/os_dep/linux/usb_intf.c b/os_dep/linux/usb_intf.c index 5a62f24..7138a26 100644 --- a/os_dep/linux/usb_intf.c @@ -57,7 +57,7 @@ index 5a62f24..7138a26 100644 ビルドし、インストールする。 -``` +```console $ cd rtl8192eu-linux-driver $ make $ sudo make install diff --git a/content/posts/use-uim-mozc.md b/content/posts/use-uim-mozc.md index 88de69102..d33e39882 100644 --- a/content/posts/use-uim-mozc.md +++ b/content/posts/use-uim-mozc.md @@ -39,7 +39,7 @@ Arch Linux向けです。 .xinitrcに以下を追記。uimを使う設定ですな。 -``` +```bash # uim export GTK_IM_MODULE='uim' export QT_IM_MODULE='uim' diff --git a/content/posts/wsl2-uses-cpu-100-percent.md b/content/posts/wsl2-uses-cpu-100-percent.md index 30332d10e..b770417a6 100644 --- a/content/posts/wsl2-uses-cpu-100-percent.md +++ b/content/posts/wsl2-uses-cpu-100-percent.md @@ -22,7 +22,7 @@ categories: ["Linux"] 具体的には、`%userprofile%.wslconfig` というファイルを作って以下の内容を書き込む。WSL2 を再起動すれば設定が適用される。 -``` +```ini [wsl2] guiApplications=false ```