Skip to content

Commit

Permalink
Check markdown style better
Browse files Browse the repository at this point in the history
  • Loading branch information
richelbilderbeek committed Sep 2, 2024
1 parent 5cc8306 commit 82b319a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 10 deletions.
26 changes: 16 additions & 10 deletions .github/workflows/check_markdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,7 @@ name: Check markdown
# 21st as the first letter of this repo is the 21st letter in the alphabet.
on:
push:
branches:
- '*'
- '!main'
pull_request:
branches:
- '*'
- '!main'
schedule:
- cron: "0 0 21 * *"

Expand All @@ -26,13 +20,25 @@ jobs:
- name: Set up Git repository
uses: actions/checkout@v4

- name: Remove folders that should not have a Markdown style check
run: |
rm -rf evaluations
rm -rf shared_documents
# Indented blocks are ignored, as the linter assumes it to be code.
# In our case, it is not: for us, it is usually an admonition (i.e. a 'question' or 'info' block)
# Here all indented text is unindented
# https://github.com/UPPMAX/UPPMAX-documentation/issues/114
- name: unindent text
run: ./scripts/unindent_text.sh

- uses: articulate/actions-markdownlint@v1
with:
config: .markdownlint.jsonc
ignore: .markdownlintignore

# There are many linters with the same name,
# this is the linter whose documentation to look into :-)
- name: CLI to the linter is at https://github.com/igorshubovych/markdownlint-cli
run: echo "CLI to the linter is at https://github.com/igorshubovych/markdownlint-cli"

# There are many linters with the same name,
# this is the linter whose documentation to look into :-)
- name: Linter is at https://github.com/DavidAnson/markdownlint
run: echo "Linter is at https://github.com/DavidAnson/markdownlint"

15 changes: 15 additions & 0 deletions scripts/unindent_text.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
#
# Unindents text in all markdown files
#
# For an indented block, a link to a broken image is ignored, as the link checker assumes it to be code.
# In our case, it is not: for us, it is usually an admonition (i.e. a 'question' or 'info' block)
# Here all indented text is unindented
# https://github.com/UPPMAX/UPPMAX-documentation/issues/114
#
for filename in $(find . | grep .md)
do
sed -i 's/^ //g' ${filename}
sed -i 's/^ //g' ${filename}
sed -i 's/^ //g' ${filename}
done

0 comments on commit 82b319a

Please sign in to comment.