-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from godot-rust/feature/markdown-lint
Format/lint using markdownlint
- Loading branch information
Showing
15 changed files
with
322 additions
and
152 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,70 @@ | ||
// https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md | ||
|
||
{ | ||
"default": true, | ||
"heading-style": { | ||
"style": "atx" | ||
}, | ||
// Unordered list bullets: - + *. | ||
"ul-style": { | ||
"style": "dash" | ||
}, | ||
"ul-indent": { | ||
"indent": 2 | ||
}, | ||
// Lists 1. 2. 3. or 1. 1. 1. | ||
"ol-prefix": { | ||
"style": "ordered" | ||
}, | ||
"no-hard-tabs": { | ||
"code_blocks": true, | ||
"ignore_code_languages": ["gdscript"], | ||
"spaces_per_tab": 4 | ||
}, | ||
"no-multiple-blanks": { | ||
// Must not be smaller to allow for "blanks-around-headers" minimum. | ||
"maximum": 2 | ||
}, | ||
"blanks-around-headings": { | ||
"lines_above": 2, | ||
"lines_below": 1 | ||
}, | ||
"line-length": { | ||
"line_length": 150, | ||
"strict": true, | ||
"code_blocks": true, | ||
// Code same line, due to admonish blocks. Real code should be max 100, but we can't check this. | ||
"code_block_line_length": 150, | ||
"tables": false | ||
}, | ||
// Punct at end of titles | ||
"no-trailing-punctuation": { | ||
"punctuation": ".,;:!。,;:!" | ||
}, | ||
// Code blocks surrounded by empty lines. | ||
"blanks-around-fences": { | ||
// Except when part of a list (to allow "tight lists") | ||
"list_items": false | ||
}, | ||
"proper-names": { | ||
"names": ["Godot", "GDScript", "Rust", "GDExtension", "gdext", "godot-rust"], | ||
"code_blocks": false | ||
}, | ||
// Indented vs ```-fenced. | ||
"code-block-style": { | ||
"style": "fenced" | ||
}, | ||
"code-fence-style": { | ||
// Would allow "tilde" for ~~~rs style. | ||
"style": "backtick" | ||
}, | ||
"emphasis-style": { | ||
"style": "underscore" | ||
}, | ||
"strong-style": { | ||
"style": "asterisk" | ||
} | ||
// If [links] inside code blocks are not recognized, and --fix removes footers, disable this. | ||
// (Links in code blocks are required by our admonish plugin). | ||
// "reference-links-images": false | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/bash | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
||
set -e | ||
|
||
show_help() { | ||
echo "Validate Markdown in the godot-rust book." | ||
echo "Usage: $0 [fix]" | ||
echo "" | ||
echo " fix: Automatically apply fixes where possible" | ||
echo " --help: Show this help menu" | ||
echo "" | ||
echo "Requires markdownlint-cli2 to be installed. You can do so as follows:" | ||
echo " npm install markdownlint-cli2 --global" | ||
} | ||
|
||
# If 'fix' is provided, append '--fix' to the end of the command | ||
if [[ "$1" == "fix" ]]; then | ||
extra="--fix" | ||
elif [[ "$1" == "help" ]] || [[ "$1" == "--help" ]]; then | ||
show_help | ||
exit 0 | ||
elif [[ -z "$1" ]]; then | ||
extra="" | ||
else | ||
echo "Incorrect usage!" | ||
show_help | ||
exit 1 | ||
fi | ||
|
||
# Could also use markdownlint-cli (command 'markdownlint') instead. Has more functionality, but the npm package is a bit heavier. | ||
|
||
# shellcheck disable=SC2086 | ||
# do not quote $extra, it shouldn't be an argument if empty. | ||
# do quote glob pattern, shell expands differently than tool itself. | ||
# keep in sync with CI arguments. | ||
markdownlint-cli2 --config .github/other/.markdownlint.jsonc ReadMe.md "src/**/*.md" $extra |
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.