Added anchors

This commit is contained in:
Igor Ranieri 2025-09-21 21:20:35 +02:00
parent 7c4603528d
commit 82e1c76fe7
2 changed files with 28 additions and 0 deletions

View file

@ -83,6 +83,7 @@ lexText = go
, link
, labeledLink
, modules
, anchors
, textElement
, quotes
, birdTrack
@ -161,6 +162,24 @@ header5 = delimitedMaybe (void $ "===== ") eol (Header Five) Nothing
header6 :: Lexer
header6 = delimitedMaybe (void $ "====== ") eol (Header Six) Nothing
-- #anchors#
anchors :: Lexer
anchors = do
pos <- getPosition
void $ try anchor'
pos' <- getPosition
txt <- anyUntil anchor'
pos'' <- getPosition
void $ try anchor'
pure
[ (pos, Anchor)
, (pos', Token txt)
, (pos'', Anchor)
]
where
anchor' = (string "#" <|> string "\\#")
-- "Module.Name"
-- "Module.Name#anchor"
-- "Module.Name#anchor"