Skip to content

Commit 39b3a44

Browse files
optimized search card preview
1 parent cc8e12b commit 39b3a44

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/export/project.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ export async function exporter(argument: ProjectExportArguments, json: any) {
526526
var item = r.item;
527527
var matches = r.matches;
528528
var baseUrl = item.url.split('#')[0];
529-
var isFirstFromCourse = !seenUrls[baseUrl];
529+
var seenUrl = seenUrls[baseUrl];
530530
seenUrls[baseUrl] = true;
531531
532532
var imgHtml = item.image
@@ -544,10 +544,12 @@ export async function exporter(argument: ProjectExportArguments, json: any) {
544544
'<div class="d-flex align-items-start">' +
545545
imgHtml +
546546
'<div class="flex-grow-1 overflow-hidden">' +
547-
(isFirstFromCourse && item.sectionTitle !== item.courseTitle
548-
? '<div class="text-muted small mb-1">' + highlight(item.courseTitle, matches, 'courseTitle') + '</div>'
547+
'<div class="d-flex align-items-baseline gap-2">' +
548+
'<div class="fw-semibold flex-shrink-0">' + highlight(item.sectionTitle, matches, 'sectionTitle') + '</div>' +
549+
(item.sectionTitle !== item.courseTitle
550+
? '<div class="text-muted small text-truncate" style="min-width:0;">(' + highlight(item.courseTitle, matches, 'courseTitle') + ')</div>'
549551
: '') +
550-
'<div class="fw-semibold">' + highlight(item.sectionTitle, matches, 'sectionTitle') + '</div>' +
552+
'</div>' +
551553
(item.sectionContent
552554
? '<div class="text-muted small text-truncate-multiline">' + highlight(excerpt(item.sectionContent, 160), matches, 'sectionContent') + '</div>'
553555
: '') +

0 commit comments

Comments
 (0)