Only make HTTP/s links as info messages
This commit is contained in:
parent
13ef15c275
commit
3eb55ca4dd
1 changed files with 6 additions and 1 deletions
7
index.js
7
index.js
|
@ -9,7 +9,11 @@ const dirPath = argv[2] || ".";
|
|||
function recurseElement(report, el) {
|
||||
if (el.name === "a") {
|
||||
if (el.attribs.href) {
|
||||
checkUrl(report, "link", el, el.attribs.href);
|
||||
if (isHttp(el.attribs.href)) {
|
||||
report.infos.push(`HTTP/S link: ${getHtml(el)}`);
|
||||
} else if (isAbsolute(el.attribs.href)) {
|
||||
report.warnings.push(`Absolute link: ${getHtml(el)}`);
|
||||
}
|
||||
} else {
|
||||
report.warnings.push(`Link with no href: ${getHtml(el)}`);
|
||||
}
|
||||
|
@ -64,6 +68,7 @@ function processFile(content) {
|
|||
} else {
|
||||
let report = {
|
||||
warnings: [],
|
||||
infos: [],
|
||||
};
|
||||
for (const el of dom) {
|
||||
if (el.type === "tag") {
|
||||
|
|
Loading…
Reference in a new issue