mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-12 20:16:15 -08:00
fix(agents): normalize internal HTML URL whitespace
This commit is contained in:
1 parent
3f8b5be06d
commit
6558245e12
3 files changed
+16
-5
No files matched your search
@@ -57,7 +57,8 @@ Only headings present outside inert HTML containers contribute slugs or duplicat
|
||||
Explicit HTML anchors use `parse5`, excluding comments, scripts, styles and template contents.
|
||||
Rendered HTML anchor and image-map area hrefs and image sources use the same local-reference checks
|
||||
as Markdown links, including decoded attributes and fragment validation.
|
||||
URL attributes discard surrounding ASCII control/space characters before resolution.
|
||||
URL attributes remove ASCII tabs/newlines throughout and discard surrounding
|
||||
ASCII control/space characters before resolution.
|
||||
Iframe/embed sources and object data attributes are document references and retain Markdown-target anchor checks.
|
||||
Image and media references must resolve to files, not directories.
|
||||
Image references check file existence without interpreting image fragments as
|
||||
|
||||
@@ -85,10 +85,9 @@ function htmlNavigation(html, inspect = () => {}) {
|
||||
(node.tagName === 'object' && attribute.name === 'data')
|
||||
)
|
||||
references.push({
|
||||
target: attribute.value.replace(
|
||||
/^[\u0000-\u0020]+|[\u0000-\u0020]+$/gu,
|
||||
''
|
||||
),
|
||||
target: attribute.value
|
||||
.replace(/[\t\n\r]/gu, '')
|
||||
.replace(/^[\u0000-\u0020]+|[\u0000-\u0020]+$/gu, ''),
|
||||
image: !['a', 'area', 'iframe', 'object', 'embed'].includes(
|
||||
node.tagName
|
||||
),
|
||||
|
||||
@@ -1370,3 +1370,14 @@ for (const tag of ['object', 'embed']) {
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
for (const entity of ['	', ' ', ' ']) {
|
||||
test(`HTML URLs remove internal tab/newline: ${entity}`, async (t) => {
|
||||
assert.deepEqual(
|
||||
await diagnostics(t, {
|
||||
'AGENTS.md': `<a href="docs/exa${entity}mple.md#repeat">Guide</a>`,
|
||||
}),
|
||||
[]
|
||||
);
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user