Skip to content

Commit

Permalink
chore(common): address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mcdurdin committed Oct 9, 2024
1 parent 016a6f0 commit eed9b81
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
20 changes: 20 additions & 0 deletions resources/tools/check-markdown/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# check-markdown

This tool is used to test the validity of internal links within product
documentation, e.g. `/android/docs/help/**/*.md`.

It currently tests that:

1. Markdown can be parsed
2. Links to other files in the same section exist (with or without .md extension)
3. Images exist

It will also optionally report on:

1. External absolute links (starting with http/https)
2. Relative links outside the root of the help documentation
3. Unnecessary use of .md extension in links

We could extend it to include:

1. Checks for anchor validity
2 changes: 1 addition & 1 deletion resources/tools/check-markdown/src/check-link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ function checkLink(root: string, file: string, token: Tokens.Link | Tokens.Image
if(href.startsWith('https:') || href.startsWith('http:')) {
messages.push({token, type:'info', message: 'External link'});
return true;

}

if(href.startsWith('/')) {
messages.push({token, type:'info', message: 'Absolute path'});
return true;
Expand Down

0 comments on commit eed9b81

Please sign in to comment.