Skip to content

Commit def0b15

Browse files
committed
Use page.id for title backref
1 parent 232dc63 commit def0b15

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

jsondoc/utils/text_with_backref.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,16 @@
1010

1111
class BackRef(BaseModel):
1212
plain_text: str
13-
block_id: str
1413
start_idx: int
1514
end_idx: int
15+
"""
16+
block_id must be set for most cases.
17+
"""
18+
block_id: str | None = None
19+
"""
20+
Used for content that do not belong to a block, e.g. page title.
21+
"""
22+
page_id: str | None = None
1623

1724

1825
class TextWithBackrefs(BaseModel):
@@ -71,7 +78,7 @@ def extract_text_with_backref_from_page(
7178
backrefs.append(
7279
BackRef(
7380
plain_text=title_text,
74-
block_id=page.id,
81+
page_id=page.id,
7582
start_idx=start_idx,
7683
end_idx=end_idx,
7784
)

0 commit comments

Comments
 (0)