Skip to content

Commit

Permalink
feat: Basic support for nested tags
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBlob42 authored and artempyanykh committed Nov 25, 2023
1 parent b846249 commit 6522553
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Marksman/Parser.fs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ module Markdown =
else
let start = slice.Start
let offsetStart = processor.GetSourcePosition(slice.Start)
let shouldAccept (c: char) = c.IsAlphaNumeric() || c = '-' || c = '_'
let shouldAccept (c: char) = c.IsAlphaNumeric() || c = '-' || c = '_' || c = '/'

while (shouldAccept (slice.PeekChar())) do
slice.NextChar() |> ignore
Expand Down
10 changes: 10 additions & 0 deletions Tests/ParserTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,16 @@ module TagsTests =
[ "T: name=tag1; range=(0,1)-(0,5) @ (0,0)-(0,5)"
"T: name=tag2; range=(0,7)-(0,11) @ (0,6)-(0,11)" ]

[<Fact>]
let tags_nested () =
let text = "#tag1/subtag1,#tag2/subtag2/subsubtag2"
let cst = scrapeString text

checkInlineSnapshot
cst
[ "T: name=tag1/subtag1; range=(0,1)-(0,13) @ (0,0)-(0,13)"
"T: name=tag2/subtag2/subsubtag2; range=(0,15)-(0,38) @ (0,14)-(0,38)" ]

module DocUrlTests =
let mkUrlNode str =
Node.mk str (Range.Mk(0, 0, 0, str.Length)) (UrlEncoded.mkUnchecked str)
Expand Down

0 comments on commit 6522553

Please sign in to comment.