Skip to content

Commit

Permalink
conn: Fix incremental update with ambiguous section refs (#344)
Browse files Browse the repository at this point in the history
  • Loading branch information
artempyanykh authored Nov 17, 2024
1 parent 92312b9 commit b8da6ba
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Marksman/Syms.fs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ module ScopeSlug =
| Def.LinkDef _ -> None
| Def.Doc -> Some(ofDocId docId)
| Def.Header(1, id) -> Some(ScopeSlug(Slug.ofString id))
| Def.Header _ -> None
| Def.Header _ -> Some(ofDocId docId)

let ofScopedDef (scope: Scope, def: Def) =
match Scope.asDoc scope with
Expand Down
17 changes: 17 additions & 0 deletions Tests/ConnTest.fs
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,23 @@ module ConnGraphTests =
let connDiff = Conn.difference fromScratch incr
checkInlineSnapshot id [ connDiff.CompactFormat() ] [ "" ]

[<Fact>]
let addTitle_CrossSection () =
let d1 =
FakeDoc.Mk(path = "d1.md", contentLines = [| "# D1"; "[[d2#sub]]" |])

let d2 = FakeDoc.Mk(path = "d2.md", contentLines = [| "# D2"; "## Sub" |])

let d1Upd =
FakeDoc.Mk(path = "d1.md", contentLines = [| "# D2"; "[[d2#sub]]" |])

let incr = mkFolder [ d1; d2 ] |> Folder.withDoc d1Upd |> Folder.conn

let fromScratch = mkFolder [ d1Upd; d2 ] |> Folder.conn

let connDiff = Conn.difference fromScratch incr
checkInlineSnapshot id [ connDiff.CompactFormat() ] [ "" ]

[<Fact>]
let fixRef () =
let d1 =
Expand Down

0 comments on commit b8da6ba

Please sign in to comment.