mirror of
https://github.com/serokell/xrefcheck.git
synced 2024-09-11 13:37:36 +03:00
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:
commit
8a6490ba7f
@ -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
|
||||
==========
|
||||
|
@ -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
|
||||
|
@ -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 =
|
||||
|
@ -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)
|
Loading…
Reference in New Issue
Block a user