Merge pull request #129 from serokell/Sereja313/#94-support-id-attribute-in-anchors

[#94] Add support for the `id` attribute in anchors
This commit is contained in:
Sereja313 2022-08-29 19:07:36 +10:00 committed by GitHub
commit 8a6490ba7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 1 deletions

View File

@ -27,6 +27,8 @@ Unreleased
+ Handle the "429 too many requests" errors & attempt to eliminate them during verification.
* [#128](https://github.com/serokell/xrefcheck/pull/128)
+ Make `ignoreRefs` a required parameter.
* [#129](https://github.com/serokell/xrefcheck/pull/129)
+ Add support for the `id` attribute in anchors
0.2.1
==========

View File

@ -154,7 +154,7 @@ nodeExtractInfo input@(Node _ _ nSubs) = do
TagOpen a attrs
| T.toLower a == "a" -> Just attrs
_ -> Nothing
(_, name) <- find (\(field, _) -> T.toLower field == "name") attributes
(_, name) <- find (\(field, _) -> T.toLower field `elem` ["name", "id"]) attributes
pure name
case mName of

View File

@ -19,6 +19,10 @@ spec = do
it "Check if anchors in headers are recognized" $ do
fi <- getFI "tests/markdowns/without-annotations/anchors_in_headers.md"
getAnchors fi `shouldBe` ["some-stuff", "stuff-section"]
it "Check if anchors with id attributes are recognized" $ do
fi <- getFI "tests/markdowns/without-annotations/anchors_in_headers_with_id_attribute.md"
getAnchors fi `shouldBe` ["some-stuff-with-id-attribute", "stuff-section-with-id-attribute"]
where
parse :: FilePath -> IO (Either Text FileInfo)
parse path =

View File

@ -0,0 +1,9 @@
<!--
- SPDX-FileCopyrightText: 2018-2019 Serokell <https://serokell.io>
-
- SPDX-License-Identifier: MPL-2.0
-->
## <a id="stuff-section-with-id-attribute"></a> Some stuff with id attribute
[My link](#stuff-section-with-id-attribute)