EPUB CFI Playground


OPF XML document

Loaded from

EPUB OPF Document

        

Content Document HTML

Loaded from

Selection History

Selection:

    Test your own CFIs

    Parse and resolve EPUB CFI
    Fuzzy match extension

    Playground Help

    This playground page shows off how the various components of EpubCfi library work together to

    • Parse a CFI
    • Resolve a CFI to an HTML Element
    • Stringify a CFI into a URL fragment

    In order to make the playground work in conventional way it resolves CFIs using the EPUB OPF document and Content Document files in the playground/public/epub/ folder. This also means that it is easy for you to replace the OPF and Content Document with your own files.

    Usage

    The Playground depends on the built lib. Start by running npm run build in the project root.

    Open your browser´s developer console. Errors will be logged there.

    Selecting text, or clicking a position within the text, will output an EPUB CFI pointing to the specific location. You can click any of the items in the output log to highlight that position again.

    There is also a text input box where you can play test your CFI skills by filling in a CFI and resolving it.

    Read the README

    For more details about EPUB CFI, how the EpubCfi library works under the hood and how to install it, have a look at the README.md file in the root of the project.