diff --git a/package.json b/package.json index 8d132c9..ffe56a8 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "alpinejs": "^3.15.8", "chart.js": "^4.5.1", "dompurify": "^3.4.16", + "fflate": "^0.8.3", "highlight.js": "^11.11.1", "htmx.org": "^2.0.8", "lunr": "^2.3.9", diff --git a/templates/annotations_banner.templ b/templates/annotations_banner.templ new file mode 100644 index 0000000..756c170 --- /dev/null +++ b/templates/annotations_banner.templ @@ -0,0 +1,138 @@ +package templates + +import "bookhoard/internal/handlers" + +// AnnotationsBanner is the book-detail slide-out listing every note and +// highlight on the book (objective 7). Rows show a friendly human location +// label (never a raw cfi:epubcfi(…) string), expand to the full rich markup +// (markdown pipeline identical to the reader's), and offer a per-row jump +// that opens the reader at the annotation's location via ?loc=. Web-only +// export lives at the top: single .md file, or one file per item zipped. +// Formatting is IDENTICAL in both modes: +// location note: "# " header + note source as body +// highlight: "# " header + note source as body +// (no note → header only) +templ AnnotationsBanner(book handlers.MediaDetail) { + + + +
+
+

Export annotations

+

Notes and highlights, as markdown files.

+
+ + +
+ +
+
+} diff --git a/templates/annotations_banner_templ.go b/templates/annotations_banner_templ.go new file mode 100644 index 0000000..c53a3d8 --- /dev/null +++ b/templates/annotations_banner_templ.go @@ -0,0 +1,61 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.3.1020 +package templates + +//lint:file-ignore SA4006 This context is only used if a nested component is present. + +import "github.com/a-h/templ" +import templruntime "github.com/a-h/templ/runtime" + +import "bookhoard/internal/handlers" + +// AnnotationsBanner is the book-detail slide-out listing every note and +// highlight on the book (objective 7). Rows show a friendly human location +// label (never a raw cfi:epubcfi(…) string), expand to the full rich markup +// (markdown pipeline identical to the reader's), and offer a per-row jump +// that opens the reader at the annotation's location via ?loc=. Web-only +// export lives at the top: single .md file, or one file per item zipped. +// Formatting is IDENTICAL in both modes: +// +// location note: "# " header + note source as body +// highlight: "# " header + note source as body +// (no note → header only) +func AnnotationsBanner(book handlers.MediaDetail) templ.Component { + return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { + return templ_7745c5c3_CtxErr + } + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var1 := templ.GetChildren(ctx) + if templ_7745c5c3_Var1 == nil { + templ_7745c5c3_Var1 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "

Notes & Highlights

Loading…