Skip to main content

get_text_lines

Callable

  • get_text_lines(node: Text, include_EOL?: boolean): TextLine[]

  • Extract all text lines from a text node.

    For example, given the following HTML:

     <p>
    First line
    Second line
    Third line
    </p>

    The HTML parser will return a Text node containing First line, Second line and Third line This function will extract the text for the node and return the following array

     [
    { offset: 0, text: 'First line' },
    { offset: 1: text: 'Second line' },
    { offset: 2, text: 'Third line' }
    ]

    Parameters

    • node: Text
    • include_EOL: boolean = false

    Returns TextLine[]