book/tools/scripts/utilities/README_LIST_FORMATTING.md
This tool ensures proper markdown list formatting by enforcing that bullet lists are preceded by an empty line. This is required for correct markdown rendering across different parsers (Quarto, GitHub, etc.).
Markdown requires an empty line before bullet lists for proper rendering:
Configuration:
- Item 1
- Item 2
Configuration:
- Item 1
- Item 2
# Check a single file
python tools/scripts/utilities/check_list_formatting.py --check file.qmd
# Check all files in a directory
python tools/scripts/utilities/check_list_formatting.py --check --recursive quarto/contents/
# Check all .qmd files in project
python tools/scripts/utilities/check_list_formatting.py --check --recursive quarto/
# Fix a single file
python tools/scripts/utilities/check_list_formatting.py --fix file.qmd
# Fix all files in a directory
python tools/scripts/utilities/check_list_formatting.py --fix --recursive quarto/contents/
# Fix all .qmd files in project
python tools/scripts/utilities/check_list_formatting.py --fix --recursive quarto/
This check is automatically run as part of pre-commit hooks in Phase 1: Auto-formatters. It will automatically fix any issues before commit.
To run manually:
pre-commit run check-list-formatting --all-files
The script identifies lines that:
:)- )When run with --fix, the script automatically inserts an empty line between the colon line and the bullet list.
0: Success (no issues found, or all issues fixed)1: Issues found (in check-only mode)GPT-2 Configuration:
- Parameters: 1.5B
- Batch size: 32
- Training time: 2 weeks
GPT-2 Configuration:
- Parameters: 1.5B
- Batch size: 32
- Training time: 2 weeks
This check complements other formatting tools in the pre-commit pipeline:
mdformat and collapse-extra-blank-lines.qmd files in the repositoryIf the tool incorrectly flags something, check:
If legitimate content is being flagged, update the exclusion rules in the script.
The script is located at:
tools/scripts/utilities/check_list_formatting.py
The hook is configured in .pre-commit-config.yaml under the local repo in Phase 1.