markdown_link_checker_sc 0.0.4 → 0.0.6
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/index.js +33 -18
- package/package.json +1 -1
- package/tests/tests1.md +42 -0
package/index.js
CHANGED
|
@@ -20,6 +20,7 @@ program
|
|
|
20
20
|
"Try a markdown file extension check if a link to HTML fails.",
|
|
21
21
|
true
|
|
22
22
|
)
|
|
23
|
+
.option("-l, --log [value]", "Export some logs for debugging. ", false)
|
|
23
24
|
.option(
|
|
24
25
|
"-f, --files <files...>",
|
|
25
26
|
"List of files to process (path relative to -d). Default is all files.",
|
|
@@ -32,6 +33,10 @@ program
|
|
|
32
33
|
|
|
33
34
|
const options = program.opts();
|
|
34
35
|
|
|
36
|
+
if (options.log == "quick") {
|
|
37
|
+
console.log(options.files);
|
|
38
|
+
}
|
|
39
|
+
|
|
35
40
|
const isMarkdown = (file) => path.extname(file).toLowerCase() === ".md";
|
|
36
41
|
const isHtml = (file) => path.extname(file).toLowerCase() === ".html";
|
|
37
42
|
const replaceDelimiter = (str, underscore) =>
|
|
@@ -373,17 +378,12 @@ function processRelativeLinks(results) {
|
|
|
373
378
|
});
|
|
374
379
|
}
|
|
375
380
|
|
|
376
|
-
function
|
|
377
|
-
//
|
|
378
|
-
|
|
379
|
-
//
|
|
380
|
-
// if this is empty skip step
|
|
381
|
-
// These are path relative, so we will need to
|
|
382
|
-
//console.log(`File options: ${options.files}`);
|
|
383
|
-
|
|
384
|
-
let resultsForSpecifiedFiles=results.allErrors;
|
|
381
|
+
function filterErrors(errors) {
|
|
382
|
+
// This method filters all errors against settings in the command line - such as pages to output.
|
|
383
|
+
let filteredErrors = errors;
|
|
384
|
+
// Filter results on specified file names (if any specified)
|
|
385
385
|
if (options.files.length > 0) {
|
|
386
|
-
|
|
386
|
+
filteredErrors = errors.filter((error) => {
|
|
387
387
|
//console.log(`Error: ${error}`);
|
|
388
388
|
//console.log(JSON.stringify(error, null, 2));
|
|
389
389
|
//console.log(`Error page: ${error.page}`);
|
|
@@ -393,18 +393,31 @@ function outputResults(results) {
|
|
|
393
393
|
pathOnly = pathOnly.slice(1);
|
|
394
394
|
}
|
|
395
395
|
//console.log(`Pathonly: ${pathOnly}`);
|
|
396
|
-
return options.files.includes(pathOnly);
|
|
396
|
+
return options.files.includes(pathOnly);
|
|
397
397
|
});
|
|
398
|
+
}
|
|
399
|
+
// Filter on other things - such as errors.
|
|
400
|
+
|
|
401
|
+
//console.log(filteredErrors);
|
|
402
|
+
return filteredErrors;
|
|
403
|
+
}
|
|
404
|
+
|
|
398
405
|
|
|
399
|
-
|
|
400
|
-
|
|
406
|
+
function outputErrors(results) {
|
|
407
|
+
//console.log(results.allErrors);
|
|
408
|
+
|
|
409
|
+
// Strip out any files that are not in options.files
|
|
410
|
+
// if this is empty skip step
|
|
411
|
+
// These are path relative, so we will need to
|
|
412
|
+
//console.log(`File options: ${options.files}`);
|
|
401
413
|
|
|
402
414
|
//Sort results by page and type.
|
|
403
415
|
// Perhaps next step is to create only get info for particular pages.
|
|
404
416
|
const sortedByPageErrors = {};
|
|
405
|
-
|
|
417
|
+
|
|
406
418
|
//for (const error of results.allErrors) {
|
|
407
|
-
for (const error of
|
|
419
|
+
for (const error of results) {
|
|
420
|
+
//Report errors for listed pages or all
|
|
408
421
|
//console.log("error:");
|
|
409
422
|
//console.log(error);
|
|
410
423
|
//console.log(error.page);
|
|
@@ -469,12 +482,14 @@ function outputResults(results) {
|
|
|
469
482
|
);
|
|
470
483
|
|
|
471
484
|
processRelativeLinks(results);
|
|
472
|
-
|
|
485
|
+
const filteredResults = filterErrors(results.allErrors);
|
|
486
|
+
outputErrors(filteredResults);
|
|
473
487
|
|
|
474
488
|
//console.log(JSON.stringify(results, null, 2));
|
|
475
489
|
//console.log("AllErrors");
|
|
476
|
-
|
|
477
|
-
|
|
490
|
+
if (options.log == "allerrors") {
|
|
491
|
+
console.log(JSON.stringify(results.allErrors, null, 2));
|
|
492
|
+
}
|
|
478
493
|
})();
|
|
479
494
|
|
|
480
495
|
//OpenQuestions
|
package/package.json
CHANGED
package/tests/tests1.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Heading One
|
|
2
|
+
|
|
3
|
+
## Heading Two
|
|
4
|
+
|
|
5
|
+
## Heading Two
|
|
6
|
+
|
|
7
|
+
## Heading Two 1
|
|
8
|
+
|
|
9
|
+
## Heading Two 2
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Heading Three
|
|
13
|
+
|
|
14
|
+
#### Heading Four
|
|
15
|
+
|
|
16
|
+
##### Heading Five
|
|
17
|
+
|
|
18
|
+
###### Heading Six
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
## Odd Named-+And*Chars`WorkedOUTER#~END
|
|
22
|
+
|
|
23
|
+
[Link Start Line](#heading-two-2) is a great one
|
|
24
|
+
|
|
25
|
+
A link in aline [Link In Line Line](#heading-two-2) that is cool
|
|
26
|
+
|
|
27
|
+
A link enbd line [Link In Line Line](#heading-two-2)
|
|
28
|
+
|
|
29
|
+
A link enbd line [Link 1 In Line Line](#heading-two-2) and [Link 2 In Line Line two](#heading-two-2) fred
|
|
30
|
+
|
|
31
|
+

|
|
32
|
+
|
|
33
|
+
dfsafd 
|
|
34
|
+
90odsf
|
|
35
|
+
|
|
36
|
+
Image in link [](#heading-two-2)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
PX4 supports numerous types of vehicles, including different configurations of multicopters, planes, VTOL vehicles, ground vehicles, etc. The complete set of supported configurations can be seen in the [Airframes Reference](../airframes/airframe_reference.md).
|
|
41
|
+
|
|
42
|
+
This section contains instructions for how to install several different [flight controllers](../flight_controller/README.md) on a number of common frames.
|