Skip to content

How to choose the right rendering to use you epub_pro excellent internal cfi management mechanism #2

@NebulaMist

Description

@NebulaMist

Dear watate,

Hello!

I have recently been studying and using your open-source repository, epub_pro. I am incredibly impressed by its excellent and robust CFI (Canonical Fragment Identifier) management system. Thank you for contributing this outstanding work to the community.

As I try to integrate epub_pro into my own project, I've encountered a challenge regarding content rendering and precise CFI mapping.

As we know, EPUB content is essentially HTML. In Flutter, a common approach to rendering HTML is using the flutter_html library. However, flutter_html does not seem to provide any way to get callbacks for DOM nodes or to calculate a precise CFI.

The only workaround I can currently think of is to define a "fuzzy" CFI based on the external blocks rendered by flutter_html (e.g., based on the Flutter widget paragraphs it generates). However, this method can only locate an approximate paragraph (e.g., .../4/2[para_5]) and cannot pinpoint the specific text node and offset (e.g., .../4/2/1:50) that epub_pro's internal mechanism is designed to handle. This largely wastes the excellent, precise CFI management you've built, which is crucial for features like highlighting and accurate bookmarks.

I've observed that it seems only components like SelectableText, which perhaps cache (or allow access to) their internal text layout and DOM structure, could possibly interface with epub_pro's internal CFI logic.

Therefore, I would like to kindly ask for your advice: In your design, how do you solve the rendering of EPUB content (HTML) while simultaneously achieving the precise CFI support that matches epub_pro's internal logic? Are you using a specific rendering widget, or do you employ another clever method to bridge the "rendering layer" and the "CFI logic layer"?

Thank you very much for your valuable time. Any insights you could provide would be of immense help to me.

Best regards,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions