function parseToFormattedLinkifiedParts(text, ignoreNewLines = false) {
    const parts = [];
    const re = ignoreNewLines ? linkRegexNoNewLine : linkRegex;
    let match;
    let index = 0;
    while ((match = re.exec(text)) !== null) {
        let link = match[0];
        const endsWithQuote = link && link.endsWith('&quot');
        // If we found an email or url match, then create a text part for everything
        // up to the match and then create the part for the email or url
        if (match.index > 0) {
            parts.push(getTextPart(text.slice(0, match.index)));
        }
        if (endsWithQuote) {
            link = link.slice(0, link.lastIndexOf('&quot'));
        }
        parts.push(getLinkPart(link, index, ignoreNewLines));

        if (endsWithQuote) {
            parts.push(getTextPart('&quot'));
        }
        text = text.substring(re.lastIndex);
        re.lastIndex = 0;
        index = index + 1;
    }
    if (text != null && text !== '') {
        parts.push(getTextPart(text));
    }
    return parts;
}
/**
 * Parse text into parts of text, links, emails, new lines
 * @param text {string} Text to parse into linkified parts
 * @param ignoreNewLines {boolean} Boolean indicating whether to return new line parts or not
 * if true new lines are included in text/url/email parts otherwise they are returned in their
 * own parts by default
 * @returns {[]}
 */
Parse text into parts of text, links, emails, new lines
@param text {string} Text to parse into linkified parts
@param ignoreNewLines {boolean} Boolean indicating whether to return new line parts or not
if true new lines are included in text/url/email parts otherwise they are returned in their
own parts by default
@returns {[]}
Parse text into parts of text links emails new lines @param text { string } Text to parse into linkified parts @param ignoreNewLines { boolean } Boolean indicating whether to return new line parts or not if true new lines are included in text / url / email parts otherwise they are returned in their own parts by default @returns { [] }
function parseToFormattedLinkifiedParts(text, ignoreNewLines = false) {
    const parts = [];
    const re = ignoreNewLines ? linkRegexNoNewLine : linkRegex;
    let match;
    let index = 0;
    while ((match = re.exec(text)) !== null) {
        let link = match[0];
        const endsWithQuote = link && link.endsWith('&quot');
        if (match.index > 0) {
            parts.push(getTextPart(text.slice(0, match.index)));
        }
        if (endsWithQuote) {
            link = link.slice(0, link.lastIndexOf('&quot'));
        }
        parts.push(getLinkPart(link, index, ignoreNewLines));
        if (endsWithQuote) {
            parts.push(getTextPart('&quot'));
        }
        text = text.substring(re.lastIndex);
        re.lastIndex = 0;
        index = index + 1;
    }
    if (text != null && text !== '') {
        parts.push(getTextPart(text));
    }
    return parts;
}
function parseToFormattedLinkifiedParts ( text , ignoreNewLines = false ) { const parts = [ ] ; const re = ignoreNewLines ? linkRegexNoNewLine : linkRegex ; let match ; let index = 0 ; while ( ( match = re . exec ( text ) ) !== null ) { let link = match [ 0 ] ; const endsWithQuote = link && link . endsWith ( '&quot' ) ; if ( match . index > 0 ) { parts . push ( getTextPart ( text . slice ( 0 , match . index ) ) ) ; } if ( endsWithQuote ) { link = link . slice ( 0 , link . lastIndexOf ( '&quot' ) ) ; } parts . push ( getLinkPart ( link , index , ignoreNewLines ) ) ; if ( endsWithQuote ) { parts . push ( getTextPart ( '&quot' ) ) ; } text = text . substring ( re . lastIndex ) ; re . lastIndex = 0 ; index = index + 1 ; } if ( text != null && text !== '' ) { parts . push ( getTextPart ( text ) ) ; } return parts ; }
Parse text into parts of text, links, emails, new lines
 @param text {string} Text to parse into linkified parts
 @param ignoreNewLines {boolean} Boolean indicating whether to return new line parts or not
 if true new lines are included in text/url/email parts otherwise they are returned in their
 own parts by default
 @returns {[]}
Parse text into parts of text links emails new lines @param text { string } Text to parse into linkified parts @param ignoreNewLines { boolean } Boolean indicating whether to return new line parts or not if true new lines are included in text / url / email parts otherwise they are returned in their own parts by default @returns { [] }
// If we found an email or url match, then create a text part for everything // up to the match and then create the part for the email or url