Skip to content

Commit

Permalink
Add url to vfile messages
Browse files Browse the repository at this point in the history
Reviewed-by: JounQin <[email protected]>
Reviewed-by: Titus Wormer <[email protected]>
Reviewed-by: Christian Murphy <[email protected]>

Closes GH-71.
  • Loading branch information
remcohaszing authored Aug 25, 2022
1 parent 5a2641a commit 53b0c24
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/check/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@ function warn(ctx, reference) {
let index = -1

while (++index < reference.nodes.length) {
reference.file.message(reason, reference.nodes[index], origin)
const message = reference.file.message(
reason,
reference.nodes[index],
origin
)
message.url = 'https://github.com/remarkjs/remark-validate-links#readme'
}
}
11 changes: 11 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,17 @@ test('remark-validate-links', async (t) => {
],
'should work on the API'
)
t.deepEqual(
vfile.messages.map((message) => message.url),
[
'https://github.com/remarkjs/remark-validate-links#readme',
'https://github.com/remarkjs/remark-validate-links#readme',
'https://github.com/remarkjs/remark-validate-links#readme',
'https://github.com/remarkjs/remark-validate-links#readme',
'https://github.com/remarkjs/remark-validate-links#readme'
],
'should add message urls'
)

const file = await remark()
.use(links)
Expand Down

0 comments on commit 53b0c24

Please sign in to comment.