-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[#211] Case insensitive anchors
- Loading branch information
Showing
13 changed files
with
170 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<!-- | ||
- SPDX-FileCopyrightText: 2022 Serokell <https://serokell.io> | ||
- | ||
- SPDX-License-Identifier: MPL-2.0 | ||
--> | ||
# Some header | ||
|
||
Some text | ||
|
||
# Another header | ||
|
||
# <a name="Another-header">Custom header</> | ||
|
||
# <a name="UPPERCASE-NAME">Custom header</> | ||
|
||
[Mixing case reference](#SomE-HEADer) | ||
|
||
[Mixing case reference](#SomE-HEADr) | ||
|
||
[Reference as it is](#UPPERCASE-NAME) | ||
|
||
[Reference lowered](#uppercase-name) | ||
|
||
[Maybe ambiguous reference](#another-header) |
23 changes: 23 additions & 0 deletions
23
tests/golden/check-case-sensitivity/check-case-sensitivity.bats
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env bats | ||
|
||
# SPDX-FileCopyrightText: 2022 Serokell <https://serokell.io> | ||
# | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
load '../helpers/bats-support/load' | ||
load '../helpers/bats-assert/load' | ||
load '../helpers/bats-file/load' | ||
load '../helpers' | ||
|
||
|
||
@test "GitHub anchors: check, ambiguous and similar detection is case-insensitive" { | ||
to_temp xrefcheck -c config-github.yaml | ||
|
||
assert_diff expected1.gold | ||
} | ||
|
||
@test "GitLab anchors: check and ambiguous detection is case-sensitive, but similar detection is not" { | ||
to_temp xrefcheck -c config-gitlab.yaml | ||
|
||
assert_diff expected2.gold | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# SPDX-FileCopyrightText: 2022 Serokell <https://serokell.io> | ||
# | ||
# SPDX-License-Identifier: Unlicense | ||
|
||
scanners: | ||
markdown: | ||
flavor: GitHub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# SPDX-FileCopyrightText: 2022 Serokell <https://serokell.io> | ||
# | ||
# SPDX-License-Identifier: Unlicense | ||
|
||
scanners: | ||
markdown: | ||
flavor: GitLab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
=== Invalid references found === | ||
|
||
➥ In file a.md | ||
bad reference (file-local) at src:18:1-36: | ||
- text: "Mixing case reference" | ||
- link: - | ||
- anchor: SomE-HEADr | ||
|
||
Anchor 'SomE-HEADr' is not present, did you mean: | ||
- some-header (header I) at src:6:1-13 | ||
- another-header (header I) at src:10:1-16 | ||
- custom-header (header I) at src:12:1-43 | ||
- Another-header (hand made) at src:12:3-27 | ||
- custom-header (header I) at src:14:1-43 | ||
|
||
➥ In file a.md | ||
bad reference (file-local) at src:24:1-44: | ||
- text: "Maybe ambiguous reference" | ||
- link: - | ||
- anchor: another-header | ||
|
||
Ambiguous reference to anchor 'another-header' | ||
In file a.md | ||
It could refer to either: | ||
- another-header (header I) at src:10:1-16 | ||
- Another-header (hand made) at src:12:3-27 | ||
Use of ambiguous anchors is discouraged because the target | ||
can change silently while the document containing it evolves. | ||
|
||
Invalid references dumped, 2 in total. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
=== Invalid references found === | ||
|
||
➥ In file a.md | ||
bad reference (file-local) at src:16:1-37: | ||
- text: "Mixing case reference" | ||
- link: - | ||
- anchor: SomE-HEADer | ||
|
||
Anchor 'SomE-HEADer' is not present, did you mean: | ||
- some-header (header I) at src:6:1-13 | ||
- another-header (header I) at src:10:1-16 | ||
- custom-header (header I) at src:12:1-43 | ||
- Another-header (hand made) at src:12:3-27 | ||
- custom-header (header I) at src:14:1-43 | ||
|
||
➥ In file a.md | ||
bad reference (file-local) at src:18:1-36: | ||
- text: "Mixing case reference" | ||
- link: - | ||
- anchor: SomE-HEADr | ||
|
||
Anchor 'SomE-HEADr' is not present, did you mean: | ||
- some-header (header I) at src:6:1-13 | ||
- another-header (header I) at src:10:1-16 | ||
- custom-header (header I) at src:12:1-43 | ||
- Another-header (hand made) at src:12:3-27 | ||
- custom-header (header I) at src:14:1-43 | ||
|
||
➥ In file a.md | ||
bad reference (file-local) at src:22:1-36: | ||
- text: "Reference lowered" | ||
- link: - | ||
- anchor: uppercase-name | ||
|
||
Anchor 'uppercase-name' is not present, did you mean: | ||
- UPPERCASE-NAME (hand made) at src:14:3-27 | ||
|
||
Invalid references dumped, 3 in total. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters