Skip to content

Commit b1b9090

Browse files
committed
conn: Fix incremental update with ambiguous section refs
stack-info: PR: #344, branch: artempyanykh/stack/4
1 parent cc7f18b commit b1b9090

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

Marksman/Syms.fs

+1-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ module ScopeSlug =
175175
| Def.LinkDef _ -> None
176176
| Def.Doc -> Some(ofDocId docId)
177177
| Def.Header(1, id) -> Some(ScopeSlug(Slug.ofString id))
178-
| Def.Header _ -> None
178+
| Def.Header _ -> Some(ofDocId docId)
179179

180180
let ofScopedDef (scope: Scope, def: Def) =
181181
match Scope.asDoc scope with

Tests/ConnTest.fs

+17
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,23 @@ module ConnGraphTests =
191191
let connDiff = Conn.difference fromScratch incr
192192
checkInlineSnapshot id [ connDiff.CompactFormat() ] [ "" ]
193193

194+
[<Fact>]
195+
let addTitle_CrossSection () =
196+
let d1 =
197+
FakeDoc.Mk(path = "d1.md", contentLines = [| "# D1"; "[[d2#sub]]" |])
198+
199+
let d2 = FakeDoc.Mk(path = "d2.md", contentLines = [| "# D2"; "## Sub" |])
200+
201+
let d1Upd =
202+
FakeDoc.Mk(path = "d1.md", contentLines = [| "# D2"; "[[d2#sub]]" |])
203+
204+
let incr = mkFolder [ d1; d2 ] |> Folder.withDoc d1Upd |> Folder.conn
205+
206+
let fromScratch = mkFolder [ d1Upd; d2 ] |> Folder.conn
207+
208+
let connDiff = Conn.difference fromScratch incr
209+
checkInlineSnapshot id [ connDiff.CompactFormat() ] [ "" ]
210+
194211
[<Fact>]
195212
let fixRef () =
196213
let d1 =

0 commit comments

Comments
 (0)