markdown_link_checker_sc 0.0.10 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -4
- package/index.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# markdown link checker sc
|
|
2
2
|
|
|
3
3
|
ALPHA - Mostly just attempting better handling of internal links.
|
|
4
|
+
Probably never coming out of alpha. Bit of fun.
|
|
4
5
|
|
|
5
6
|
Markdown link checker in node.
|
|
6
7
|
Better handling of internal link checking.
|
|
@@ -9,10 +10,34 @@ Better handling of internal link checking.
|
|
|
9
10
|
Current version only does internal link checking
|
|
10
11
|
|
|
11
12
|
```
|
|
12
|
-
Usage:
|
|
13
|
+
Usage: markdown_link_checker_sc [options]
|
|
13
14
|
|
|
14
15
|
Options:
|
|
15
|
-
-d, --directory [directory] The directory to search for markdown and html files (default:
|
|
16
|
-
|
|
17
|
-
--
|
|
16
|
+
-d, --directory [directory] The directory to search for markdown and html files (default:
|
|
17
|
+
"D:\\github\\hamishwillee\\markdown_link_checker_sc")
|
|
18
|
+
-s, --headingAnchorSlugify [value] Slugify approach for turning markdown headings into heading anchors. Currently
|
|
19
|
+
support vuepress only and always (default: "vuepress")
|
|
20
|
+
-t, --tryMarkdownforHTML [value] Try a markdown file extension check if a link to HTML fails. (default: true)
|
|
21
|
+
-l, --log [value] Export some logs for debugging. (default: false)
|
|
22
|
+
-f, --files <path> JSON file with array of files to report on (default is all files). Paths are
|
|
23
|
+
relative relative to -d by default, but -r can be used to set a different root.
|
|
24
|
+
(default: "")
|
|
25
|
+
-r, --root <path> Directory to prepend before file paths in the JSON directory. Default is same as
|
|
26
|
+
directory. Useful if directory is not your repo root (default: "")
|
|
27
|
+
-h, --help display help for command
|
|
18
28
|
```
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
The way this works:
|
|
32
|
+
- Sspecify the directory and it will search below that for all markdown/html files.
|
|
33
|
+
- It loads each file, and:
|
|
34
|
+
- parses for markdown and html style links for both page and image links.
|
|
35
|
+
- parses headings and builds list of anchors in the page (as per vuepress) for those headings (poorly tested code)
|
|
36
|
+
- parses for html elements with ids, that are also link targets.
|
|
37
|
+
- Then it parses the results, comparing internal links to internal anchors to see if it can find matching files, and matching headings or anchors within files.
|
|
38
|
+
- If it can't match, that is an error - which gets added to the list of errors with a type and enough detail to handle.
|
|
39
|
+
- Errors are then filtered based on:
|
|
40
|
+
- pages in a json file defined using -f (and possibly -r).
|
|
41
|
+
- Finally the output is exported in a markdown friendly output format.
|
|
42
|
+
|
|
43
|
+
Lots more to do, but this already catches lots of internal errors.
|
package/index.js
CHANGED
|
@@ -11,7 +11,7 @@ program
|
|
|
11
11
|
process.cwd()
|
|
12
12
|
)
|
|
13
13
|
.option(
|
|
14
|
-
"-
|
|
14
|
+
"-s, --headingAnchorSlugify [value]",
|
|
15
15
|
"Slugify approach for turning markdown headings into heading anchors. Currently support vuepress only and always",
|
|
16
16
|
"vuepress"
|
|
17
17
|
)
|
|
@@ -449,7 +449,7 @@ function outputErrors(results) {
|
|
|
449
449
|
|
|
450
450
|
//console.log(sortedByPageErrors);
|
|
451
451
|
for (page in sortedByPageErrors) {
|
|
452
|
-
console.log(
|
|
452
|
+
console.log(`\n${page}`);
|
|
453
453
|
for (const error of sortedByPageErrors[page]) {
|
|
454
454
|
if (error.type == "InternalLinkMissingFile") {
|
|
455
455
|
console.log(`- ${error.type}: ${error.linkUrl}`);
|