Personal markdownlint config
- Linting and autofixing markdown files
npm i --save-dev @schoero/markdownlint-config
Create a .markdownlint.jsonc
file with the following content:
{
"extends": "@schoero/markdownlint-config"
}
For automatic code formatting on save, install the markdownlint extension.
To recommend the extension in your repository create a .vscode/extensions.json
with the following content:
{
"recommendations": [
"DavidAnson.vscode-markdownlint"
]
}
To configure the extension properly, create a .vscode/settings.json
with the following content:
{
"[markdown]": {
"editor.defaultFormatter": "DavidAnson.vscode-markdownlint",
"editor.formatOnSave": true
},
"editor.codeActionsOnSave": {
"source.fixAll.markdownlint": true
}
}
If you want to have linting scripts, you can use something like this in the package.json
:
{
"scripts": {
"markdownlint": "node_modules/markdownlint-cli2/markdownlint-cli2.js '**/*.md' '#node_modules'",
"markdownlint:ci": "npm run markdownlint",
"markdownlint:fix": "node_modules/markdownlint-cli2/markdownlint-cli2-fix.js '**/*.md' '#node_modules'"
}
}