Skip to content

Commit 08fc3a2

Browse files
committed
Add configPointer input, examples for package.json/pyproject.toml.
1 parent 154744f commit 08fc3a2

File tree

9 files changed

+401
-3
lines changed

9 files changed

+401
-3
lines changed

.github/dictionary.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
CommonMark
22
config
3+
configPointer
4+
JSON
35
LLMs
46
markdownlint-cli2-action
57
npm

.github/workflows/test.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,36 @@ jobs:
9696
id: test
9797
- run: exit 1
9898
if: steps.test.outcome != 'failure'
99+
package-json:
100+
name: package.json (test/errors.md, 2 errors)
101+
runs-on: ubuntu-latest
102+
steps:
103+
- uses: actions/checkout@v6
104+
- run: rm .markdownlint.json
105+
- uses: ./
106+
with:
107+
config: 'config/package.json'
108+
configPointer: '/markdownlint-cli2'
109+
globs: 'test/*.md'
110+
continue-on-error: true
111+
id: test
112+
- run: exit 1
113+
if: steps.test.outcome != 'failure'
114+
pyproject-toml:
115+
name: pyproject.toml (test/errors.md, 2 errors)
116+
runs-on: ubuntu-latest
117+
steps:
118+
- uses: actions/checkout@v6
119+
- run: rm .markdownlint.json
120+
- uses: ./
121+
with:
122+
config: 'config/pyproject.toml'
123+
configPointer: '/tool/markdownlint-cli2'
124+
globs: 'test/*.md'
125+
continue-on-error: true
126+
id: test
127+
- run: exit 1
128+
if: steps.test.outcome != 'failure'
99129
fix:
100130
name: fix (test/errors.md, 0 errors)
101131
runs-on: ubuntu-latest

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ Path of a file to use for the base configuration object (defaults to none)
2020
Equivalent to using the `--config` [command-line option][command-line] and
2121
passing the specified configuration file.
2222

23+
### configPointer (optional)
24+
25+
[JSON Pointer][json-pointer] to a configuration object within the `--config`
26+
file (defaults to none)
27+
28+
Equivalent to using the `--configPointer` [command-line option][command-line]
29+
and passing the specified JSON Pointer.
30+
2331
### fix (optional)
2432

2533
Whether to fix supported issues automatically (any truthy value enables)
@@ -100,6 +108,26 @@ To specify a custom configuration file:
100108
globs: '**/*.md'
101109
```
102110
111+
To specify an embedded object in `package.json`:
112+
113+
```yaml
114+
- uses: DavidAnson/markdownlint-cli2-action@v22
115+
with:
116+
config: 'package.json'
117+
configPointer: '/markdownlint-cli2'
118+
globs: '**/*.md'
119+
```
120+
121+
To specify an embedded object in `pyproject.toml`:
122+
123+
```yaml
124+
- uses: DavidAnson/markdownlint-cli2-action@v22
125+
with:
126+
config: 'pyproject.toml'
127+
configPointer: '/tool/markdownlint-cli2'
128+
globs: '**/*.md'
129+
```
130+
103131
To prevent linting issues from failing the workflow run:
104132

105133
```yaml
@@ -119,6 +147,7 @@ and/or gradually introducing linting rules to a new repository).
119147
[commonmark]: https://commonmark.org/
120148
[example-yml]: .github/workflows/example.yml
121149
[glob-syntax]: https://github.com/DavidAnson/markdownlint-cli2#use
150+
[json-pointer]: https://datatracker.ietf.org/doc/html/rfc6901
122151
[markdown]: https://wikipedia.org/wiki/Markdown
123152
[markdownlint]: https://github.com/DavidAnson/markdownlint
124153
[markdownlint-cli2]: https://github.com/DavidAnson/markdownlint-cli2

action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ inputs:
99
description: Path of a file to use for the base configuration object (defaults to none)
1010
default: ''
1111
required: false
12+
configPointer:
13+
description: JSON Pointer to a configuration object within the --config file (defaults to none)
14+
default: ''
15+
required: false
1216
fix:
1317
description: Whether to fix supported issues automatically (any truthy value enables)
1418
default: ''

config/package.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"private": true,
3+
4+
"markdownlint-cli2": {
5+
"config": {
6+
"single-trailing-newline": false
7+
}
8+
}
9+
}

config/pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[project]
2+
name = "my-project"
3+
4+
[tool.markdownlint-cli2.config]
5+
single-trailing-newline = false

0 commit comments

Comments
 (0)