Trilium Backend API
    Preparing search index...

    Interface InternalOptions

    Internal options for Cheerio.

    interface InternalOptions {
        _useHtmlParser2?: boolean;
        baseURI?: string | URL;
        decodeEntities?: boolean;
        emptyAttrs?: boolean;
        encodeEntities?: boolean | "utf8";
        lowerCaseAttributeNames?: boolean;
        lowerCaseTags?: boolean;
        onParseError?: ParserErrorHandler;
        pseudos?: Record<
            string,
            string
            | ((elem: Element, value?: string) => boolean),
        >;
        quirksMode?: boolean;
        recognizeCDATA?: boolean;
        recognizeSelfClosing?: boolean;
        scriptingEnabled?: boolean;
        selfClosingTags?: boolean;
        sourceCodeLocationInfo?: boolean;
        Tokenizer?: typeof default;
        treeAdapter?: TreeAdapter<Htmlparser2TreeAdapterMap>;
        withEndIndices?: boolean;
        withStartIndices?: boolean;
        xmlMode?: boolean;
    }

    Hierarchy (View Summary)

    Index

    Properties

    _useHtmlParser2?: boolean

    Whether to use htmlparser2.

    This is set to true if xml is set to true.

    baseURI?: string | URL

    The base URI for the document. Used to resolve the href and src props.

    decodeEntities?: boolean

    Option inherited from parsing; will be used as the default value for encodeEntities.

    true
    
    emptyAttrs?: boolean

    Print an empty attribute's value.

    xmlMode
    
    With <code>emptyAttrs: false</code>: <code>&lt;input checked&gt;</code>
    
    With <code>emptyAttrs: true</code>: <code>&lt;input checked=""&gt;</code>
    
    encodeEntities?: boolean | "utf8"

    Encode characters that are either reserved in HTML or XML.

    If xmlMode is true or the value not 'utf8', characters outside of the utf8 range will be encoded as well.

    decodeEntities

    lowerCaseAttributeNames?: boolean

    If set to true, all attribute names will be lowercased. This has noticeable impact on speed.

    !xmlMode
    
    lowerCaseTags?: boolean

    If set to true, all tags will be lowercased.

    !xmlMode
    
    onParseError?: ParserErrorHandler

    Callback for parse errors.

    null

    pseudos?: Record<string, string | ((elem: Element, value?: string) => boolean)>

    Extension point for pseudo-classes.

    Maps from names to either strings of functions.

    • A string value is a selector that the element must match to be selected.
    • A function is called with the element as its first argument, and optional parameters second. If it returns true, the element is selected.
    const $ = cheerio.load(
    '<div class="foo"></div><div data-bar="boo"></div>',
    {
    pseudos: {
    // `:foo` is an alias for `div.foo`
    foo: 'div.foo',
    // `:bar(val)` is equivalent to `[data-bar=val s]`
    bar: (el, val) => el.attribs['data-bar'] === val,
    },
    },
    );

    $(':foo').length; // 1
    $('div:bar(boo)').length; // 1
    $('div:bar(baz)').length; // 0
    quirksMode?: boolean

    Is the document in quirks mode?

    This will lead to .className and #id being case-insensitive.

    false
    
    recognizeCDATA?: boolean

    If set to true, CDATA sections will be recognized as text even if the xmlMode option is not enabled. NOTE: If xmlMode is set to true then CDATA sections will always be recognized as text.

    xmlMode
    
    recognizeSelfClosing?: boolean

    If set to true, self-closing tags will trigger the onclosetag event even if xmlMode is not set to true. NOTE: If xmlMode is set to true then self-closing tags will always be recognized.

    xmlMode
    
    scriptingEnabled?: boolean

    The scripting flag. If set to true, noscript element content will be parsed as text.

    true

    selfClosingTags?: boolean

    Print self-closing tags for tags without contents.

    xmlMode
    
    With <code>selfClosingTags: false</code>: <code>&lt;foo&gt;&lt;/foo&gt;</code>
    
    With <code>selfClosingTags: true</code>: <code>&lt;foo /&gt;</code>
    
    sourceCodeLocationInfo?: boolean

    Enables source code location information. When enabled, each node (except the root node) will have a sourceCodeLocation property. If the node is not an empty element, sourceCodeLocation will be a ElementLocation object, otherwise it will be Location. If the element was implicitly created by the parser (as part of tree correction), its sourceCodeLocation property will be undefined.

    false

    Tokenizer?: typeof default

    Allows the default tokenizer to be overwritten.

    Specifies the resulting tree format.

    treeAdapters.default

    withEndIndices?: boolean

    Add an endIndex property to nodes. When the parser is used in a non-streaming fashion, endIndex is an integer indicating the position of the end of the node in the document.

    false
    
    withStartIndices?: boolean

    Add a startIndex property to nodes. When the parser is used in a non-streaming fashion, startIndex is an integer indicating the position of the start of the node in the document.

    false
    
    xmlMode?: boolean

    Treat the input as an XML document.