Skip to content

Commit 348d78a

Browse files
fix: page title highlighting
1 parent d451802 commit 348d78a

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

typescript/src/renderer/JsonDocRenderer.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export const JsonDocRenderer = ({
5757
)}
5858
{/* Page title */}
5959
{page.properties?.title && (
60-
<h1 className="json-doc-page-title">
60+
<h1 className="json-doc-page-title" data-page-id={page.id}>
6161
{page.properties.title.title?.[0]?.plain_text || "Untitled"}
6262
</h1>
6363
)}
@@ -106,7 +106,6 @@ export const JsonDocRenderer = ({
106106
<div className={`json-doc-renderer ${className}`}>
107107
{viewJson ? (
108108
<div className="flex h-screen">
109-
<div className="w-1/2 overflow-y-auto">{renderedContent}</div>
110109
<JsonViewPanel data={page} />
111110
</div>
112111
) : (

typescript/src/renderer/utils/highlightUtils.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,14 @@ export function processBackref(backref: Backref): HTMLSpanElement | null {
130130
/**
131131
* Processes a backref that targets a page title
132132
*/
133-
export function processPageTitleBackref(backref: Backref): HTMLSpanElement | null {
133+
export function processPageTitleBackref(
134+
backref: Backref
135+
): HTMLSpanElement | null {
134136
// Find the specific page title element using data-page-id
135137
const pageTitleElement = document.querySelector(
136138
`[data-page-id="${backref.page_id}"]`
137139
);
138-
140+
139141
if (!pageTitleElement) {
140142
return null;
141143
}

typescript/tests/test-cases.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
- page title highlighting work
2+
- block highlighting should work
3+
- invalid backref shouldn't trigger highlighting
4+
- incorrect block page number shouldn't break the rendering
5+
- make sure all blocks are rendered
6+
- make sure numbered lists are correctly labeled
7+
- make sure bad page is gracefully handled
8+
- invalid block type should show error block UI

0 commit comments

Comments
 (0)