Skip to content

Conversation

digithree
Copy link
Contributor

@digithree digithree commented May 31, 2025

Creates a new reader view as the default display for bookmarked articles (links) when list items are tapped, i.e. the bookmark detail view.

Description

When a link bookmark was successfully scraped from a web page source (likely an article) HTML will be available on request as bookmark.content.htmlContent. This PR makes the change firstly to request this by setting request flag includeContent, and then if content is present, to display it in-line in the app. If no content is available, the link will fallback to the previous behaviour of using an embedded

Note:

  • the usage of bookmark.content.htmlContent is assumed safe and depends on any previous efforts to clean this at the time the bookmark was added and processed
  • users may still access the original link using the link/globe icon in the app footer nav bar (right-most icon, see screenshot below)

Testing

This change was tested on Android only. I was unable to get my iOS build environment configured yet so it would be good if someone could test this as an iOS build. I would be very confident it will work just as well on iOS.

Related tickets

Implements: #536 basic implementation. Also mentioned is caching and screenshot view, which is not implemented here. Local DB storage of readable article content is out of scope for this PR but a good idea for another PR

See also:

Screenshots and video

Note, all media is from Android testing.

Link bookmark detail view, reader view

bookmark_link_reader

Link bookmark detail view, fallback to WebView

bookmark_link_webview

Complete user journey, video

complete_user_journey_720p.mp4

@Copilot Copilot AI review requested due to automatic review settings May 31, 2025 18:29
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enables an inline reader view for bookmarked links by requesting scraped HTML content and rendering it with custom styling; it falls back to the existing WebView when no content is available.

  • Render bookmark.content.htmlContent inside a styled WebView when present
  • Add includeContent: true to the bookmarks query to fetch HTML content
  • Preserve fallback to embedded WebView for links without scraped content
Comments suppressed due to low confidence (4)

apps/mobile/app/dashboard/bookmarks/[slug]/index.tsx:165

  • The inline HTML and CSS template is lengthy and embedded directly in the component. Consider extracting it into a separate constant or helper function (or even an external file) to improve readability and maintainability.
source: { html: `

apps/mobile/app/dashboard/bookmarks/[slug]/index.tsx:165

  • The HTML string is reconstructed on every render. Wrap its construction in useMemo (dependent on htmlContent) to avoid unnecessary re-creation and improve performance.
source: { html: `

apps/mobile/app/dashboard/bookmarks/[slug]/index.tsx:159

  • There’s no test covering the new reader-view branch when htmlContent is present. Add a test to verify that the styled WebView is rendered correctly for bookmarks with HTML content.
if (bookmark.content.htmlContent) {

apps/mobile/app/dashboard/bookmarks/[slug]/index.tsx:206

  • Injecting raw HTML from bookmark.content.htmlContent into the WebView could introduce XSS risks if the content isn’t fully sanitized. Ensure content is cleaned or sanitized before rendering.
${bookmark.content.htmlContent}

@digithree digithree marked this pull request as draft May 31, 2025 20:01
@digithree
Copy link
Contributor Author

Marked as draft, I neglected to test on dark mode, the current reader view impl does not apply dark theme. I will fix this shortly

@digithree
Copy link
Contributor Author

Dark mode support for mobile reader mode has been added

mobile-reader-dark-mode

mobile-reader-dark-mode-720p.mp4

@digithree digithree marked this pull request as ready for review June 3, 2025 17:31
@digithree
Copy link
Contributor Author

@MohamedBassem ready for review

@MohamedBassem MohamedBassem merged commit ec31a97 into karakeep-app:main Jun 7, 2025
4 of 5 checks passed
@MohamedBassem
Copy link
Collaborator

@digithree I've added implementation for the other views as part of this commit. Thank you for getting this started!

@digithree
Copy link
Contributor Author

@MohamedBassem my pleasure. Good thinking to get the other types covered, and good improvement readings loading handling on the link content, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants