Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jump to a specific paragraph #61

Open
higginator opened this issue Aug 24, 2015 · 2 comments
Open

Jump to a specific paragraph #61

higginator opened this issue Aug 24, 2015 · 2 comments

Comments

@higginator
Copy link

Hello.

Is there a way to jump to a specific paragraph within an epub? My end goal is to sync 2 books. When a user highlights a word in book1, I would like to know the paragraph id that this word belongs to. And then I would like to load book2, jumping to the location of the paragraph with the same id.

I see that I can do this on a page by page basis, using each spineItem's spineItemIndex and spineItemPageIndex and initializing/pushing to the navigationController a new EPubViewController. But I would like to narrow in to the paragraph level.

(Just thinking now...perhaps this would require giving each paragraph an id attribute when the epub's are being authored. <p id=1'>.......)

@rkwright
Copy link
Member

The short answer is that you can target specific paragraphs in a unique fashion using CFIs (Canonical Fragment Identifiers). See http://www.idpf.org/epub/linking/cfi/epub-cfi.html.
The long answer will require some research and experimentation.

@danielweck
Copy link
Member

You may also be interested in an upcoming EPUB3 feature called "Multiple Renditions" and in particular the "Mapping Document": http://www.idpf.org/epub/renditions/multiple/
There is an experimental implementation in ReadiumJS, see the epub3MultipleRenditions feature branch:
https://github.com/readium/readium-js-viewer/tree/feature/epub3MultipleRenditions
https://github.com/readium/readium-js/tree/feature/epub3MultipleRenditions
https://github.com/readium/readium-shared-js/tree/feature/epub3MultipleRenditions

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

No branches or pull requests

3 participants