Skip to content

Commit 53b0c24

Browse files
authored
Add url to vfile messages
Reviewed-by: JounQin <admin@1stg.me> Reviewed-by: Titus Wormer <tituswormer@gmail.com> Reviewed-by: Christian Murphy <christian.murphy.42@gmail.com> Closes GH-71.
1 parent 5a2641a commit 53b0c24

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

lib/check/validate.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,11 @@ function warn(ctx, reference) {
127127
let index = -1
128128

129129
while (++index < reference.nodes.length) {
130-
reference.file.message(reason, reference.nodes[index], origin)
130+
const message = reference.file.message(
131+
reason,
132+
reference.nodes[index],
133+
origin
134+
)
135+
message.url = 'https://github.com/remarkjs/remark-validate-links#readme'
131136
}
132137
}

test/index.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,17 @@ test('remark-validate-links', async (t) => {
4141
],
4242
'should work on the API'
4343
)
44+
t.deepEqual(
45+
vfile.messages.map((message) => message.url),
46+
[
47+
'https://github.com/remarkjs/remark-validate-links#readme',
48+
'https://github.com/remarkjs/remark-validate-links#readme',
49+
'https://github.com/remarkjs/remark-validate-links#readme',
50+
'https://github.com/remarkjs/remark-validate-links#readme',
51+
'https://github.com/remarkjs/remark-validate-links#readme'
52+
],
53+
'should add message urls'
54+
)
4455

4556
const file = await remark()
4657
.use(links)

0 commit comments

Comments
 (0)