@likecoin/epub-ts
    Preparing search index...

    Class Section

    Represents a Section of the Book

    In most books this is equivalent to a Chapter

    The spine item representing the section

    hooks for serialize and content

    Index

    Constructors

    Properties

    canonical: string
    cfiBase: string | undefined
    contents: Element | undefined
    document: Document | undefined
    hooks: { content: Hook; serialize: Hook } | undefined
    href: string | undefined
    idref: string | undefined
    index: number | undefined
    linear: boolean | undefined
    next: (() => Section | undefined) | undefined
    output: string | undefined
    prev: (() => Section | undefined) | undefined
    properties: string[] | undefined
    url: string | undefined

    Methods

    • Get a CFI from an Element in the Section

      Parameters

      • el: Element

      Returns string

      cfi an EpubCFI string

    • Get a CFI from a Range in the Section

      Parameters

      • _range: Range

      Returns string

      cfi an EpubCFI string

    • Find a string in a section

      Parameters

      • _query: string

        The query string to find

      Returns SearchResult[]

      A list of matches, with form {cfi, excerpt}

    • Load the section from its url

      Parameters

      Returns Promise<Element>

      a promise with the xml document

    • Reconciles the current chapters layout properties with the global layout properties.

      Parameters

      • globalLayout: GlobalLayout

        The global layout settings object, chapter properties string

      Returns Record<string, string>

      layoutProperties Object with layout properties

    • Render the contents of a section

      Parameters

      Returns Promise<string>

      output a serialized XML Document

    • Search a string in multiple sequential Element of the section.

      Parameters

      • _query: string

        The query string to search

      • maxSeqEle: number = 5

        The maximum number of Element that are combined for search, default value is 5.

      Returns SearchResult[]

      A list of matches, with form {cfi, excerpt}

    • Unload the section document

      Returns void