fix: address docs checker review findings
Check every link reference definition, decode destinations per CommonMark, report correct lines for empty headings, autolinks and nested definitions, reject symlinked record directories and wrong-case path components, and refuse titles that cannot pass. Only top-level headings count (spec section 6). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
789931d90f
commit
d579e38ba5
8 files changed
+146
-27
No files matched your search
@@ -16,6 +16,12 @@ func TestLinkDestinations(t *testing.T) {
|
||||
{"#anchor", ""},
|
||||
{"mailto:a@example.com", ""},
|
||||
{"https://example.com/a?b=1#c", ""},
|
||||
{`/docs/spec\.txt`, ""},
|
||||
{"/docs/spec.txt", ""},
|
||||
{"/docs/spec.txt", ""},
|
||||
{`/docs\\spec.txt`, "backslash"},
|
||||
{"/docs/SPEC.txt", "does not exist"},
|
||||
{"/Docs/spec.txt", "does not exist"},
|
||||
{"foo.md", "relative"},
|
||||
{"./foo.md", "relative"},
|
||||
{"../docs/spec.txt", "relative"},
|
||||
@@ -64,6 +70,11 @@ func TestLinkForms(t *testing.T) {
|
||||
{"image", "", []string{":35: relative"}},
|
||||
{"autolink", "<ftp://example.com/x>", []string{":35: scheme"}},
|
||||
{"reference link and definition", "[x][r]\n\n[r]: foo.md", []string{":35: relative", ":37: relative"}},
|
||||
{"duplicate definition is checked", "[a]: /docs/spec.txt\n\n[a]: ../bad.md", []string{":37: relative"}},
|
||||
{"definition in a blockquote", "> [Zed]: ../bad.md", []string{":35: relative"}},
|
||||
{"definition-like line in code", "```\n[a]: x\n```\n\n[a]: ../bad.md", []string{":39: relative"}},
|
||||
{"autolink on a later line", "Para one\nline two\n<ftp://example.com/x>", []string{":37: scheme"}},
|
||||
{"image without alt on a later line", "Para one\nline two\n", []string{":37: relative"}},
|
||||
{"unused definition", "[r]: foo.md", []string{":35: relative"}},
|
||||
{"link in a list", "* [x](foo.md)", []string{":35: relative"}},
|
||||
{"bare URL and raw HTML are not checked", "http://u:p@example.com and @user #123 abc1234\n\n<a href=\"foo.md\">x</a>", nil},
|
||||
|
||||
Reference in new issue
Block a user