Back to Trilium

Interface Cheerio

docs/Script API/interfaces/Backend_Script_API._internal_.Cheerio.html

0.102.228.4 KB
Original Source

Interface Cheerio

interface Cheerio {
cheerio: string;
length: number;
"[iterator]"(): IterableIterator<Element>;
add(selectorOrHtml: string): Cheerio;
add(selector: string, context: Document): Cheerio;
add(element: Element): Cheerio;
add(elements: Element[]): Cheerio;
add(selection: Cheerio): Cheerio;
addBack(): Cheerio;
addBack(filter: string): Cheerio;
addClass(classNames: string): Cheerio;
after(content: string, ...contents: any[]): Cheerio;
after(content: Document, ...contents: any[]): Cheerio;
after(content: Document[], ...contents: any[]): Cheerio;
after(content: Cheerio, ...contents: any[]): Cheerio;
append(content: string, ...contents: any[]): Cheerio;
append(content: Document, ...contents: any[]): Cheerio;
append(content: Document[], ...contents: any[]): Cheerio;
append(content: Cheerio, ...contents: any[]): Cheerio;
appendTo(target: Cheerio): Cheerio;
attr(): { [attr: string]: string };
attr(name: string): undefined | string;
attr(name: string, value: AttrFunction): Cheerio;
attr(name: string, value: string): Cheerio;
attr(map: { [key: string]: any }): Cheerio;
before(content: string, ...contents: any[]): Cheerio;
before(content: Document, ...contents: any[]): Cheerio;
before(content: Document[], ...contents: any[]): Cheerio;
before(content: Cheerio, ...contents: any[]): Cheerio;
children(selector?: string): Cheerio;
clone(): Cheerio;
closest(): Cheerio;
closest(selector: string): Cheerio;
contents(): Cheerio;
css(propertyName?: string): string;
css(propertyNames: string[]): string[];
css(propertyName: string, value: string): Cheerio;
css(propertyName: string, value: number): Cheerio;
css(
propertyName: string,
func: (index: number, value: string) => string,
): Cheerio;
css(
propertyName: string,
func: (index: number, value: string) => number,
): Cheerio;
css(properties: Object): Cheerio;
data(): any;
data(name: string): any;
data(name: string, value: any): any;
each(func: (index: number, element: Element) => any): Cheerio;
empty(): Cheerio;
end(): Cheerio;
eq(index: number): Cheerio;
filter(selector: string): Cheerio;
filter(selection: Cheerio): Cheerio;
filter(element: Element): Cheerio;
filter(elements: Element[]): Cheerio;
filter(func: (index: number, element: Element) => boolean): Cheerio;
find(selector: string): Cheerio;
find(element: Cheerio): Cheerio;
first(): Cheerio;
get(): any[];
get(index: number): any;
has(selector: string): Cheerio;
has(element: Element): Cheerio;
hasClass(className: string): boolean;
html(): null | string;
html(html: string): Cheerio;
index(): number;
index(selector: string): number;
index(selection: Cheerio): number;
insertAfter(content: string): Cheerio;
insertAfter(content: Document): Cheerio;
insertAfter(content: Cheerio): Cheerio;
insertBefore(content: string): Cheerio;
insertBefore(content: Document): Cheerio;
insertBefore(content: Cheerio): Cheerio;
is(selector: string): boolean;
is(element: Element): boolean;
is(element: Element[]): boolean;
is(selection: Cheerio): boolean;
is(func: (index: number, element: Element) => boolean): boolean;
last(): Cheerio;
map(func: (index: number, element: Element) => any): Cheerio;
next(selector?: string): Cheerio;
nextAll(): Cheerio;
nextAll(selector: string): Cheerio;
nextUntil(selector?: string, filter?: string): Cheerio;
nextUntil(element: Element, filter?: string): Cheerio;
nextUntil(element: Cheerio, filter?: string): Cheerio;
not(selector: string): Cheerio;
not(selection: Cheerio): Cheerio;
not(element: Element): Cheerio;
not(func: (index: number, element: Element) => boolean): Cheerio;
parent(selector?: string): Cheerio;
parents(selector?: string): Cheerio;
parentsUntil(selector?: string, filter?: string): Cheerio;
parentsUntil(element: Element, filter?: string): Cheerio;
parentsUntil(element: Cheerio, filter?: string): Cheerio;
prepend(content: string, ...contents: any[]): Cheerio;
prepend(content: Document, ...contents: any[]): Cheerio;
prepend(content: Document[], ...contents: any[]): Cheerio;
prepend(content: Cheerio, ...contents: any[]): Cheerio;
prependTo(target: Cheerio): Cheerio;
prev(selector?: string): Cheerio;
prevAll(): Cheerio;
prevAll(selector: string): Cheerio;
prevUntil(selector?: string, filter?: string): Cheerio;
prevUntil(element: Element, filter?: string): Cheerio;
prevUntil(element: Cheerio, filter?: string): Cheerio;
prop(name: string): any;
prop(name: string, value: any): Cheerio;
remove(selector?: string): Cheerio;
removeAttr(name: string): Cheerio;
removeClass(): Cheerio;
removeClass(className: string): Cheerio;
removeClass(func: (index: number, className: string) => string): Cheerio;
replaceWith(content: string): Cheerio;
replaceWith(content: Element): Cheerio;
replaceWith(content: Element[]): Cheerio;
replaceWith(content: Cheerio): Cheerio;
replaceWith(content: () => Cheerio): Cheerio;
serialize(): string;
serializeArray(): { name: string; value: string }[];
siblings(selector?: string): Cheerio;
slice(start: number, end?: number): Cheerio;
text(): string;
text(text: string): Cheerio;
toArray(): Element[];
toggleClass(className: string): Cheerio;
toggleClass(className: string, toggleSwitch: boolean): Cheerio;
toggleClass(toggleSwitch?: boolean): Cheerio;
toggleClass(
func: (
index: number,
className: string,
toggleSwitch: boolean,
) => string,
toggleSwitch?: boolean,
): Cheerio;
val(): string;
val(value: string): Cheerio;
wrap(content: string): Cheerio;
wrap(content: Document): Cheerio;
wrap(content: Cheerio): Cheerio;
index: number: Element;
}

Indexable

Index

Properties

cheeriolength

Methods

[iterator]addaddBackaddClassafterappendappendToattrbeforechildrencloneclosestcontentscssdataeachemptyendeqfilterfindfirstgethashasClasshtmlindexinsertAfterinsertBeforeislastmapnextnextAllnextUntilnotparentparentsparentsUntilprependprependToprevprevAllprevUntilpropremoveremoveAttrremoveClassreplaceWithserializeserializeArraysiblingsslicetexttoArraytoggleClassvalwrap

Properties

cheerio

cheerio: string

length

length: number

Methods

[iterator]

"[iterator]"(): IterableIterator<Element>

Returns IterableIterator<Element>

add

add(selectorOrHtml: string): Cheerio

Parameters

  • selectorOrHtml: string

Returns Cheerio

add(selector: string, context: Document): Cheerio

Parameters

  • selector: string
  • context: Document

Returns Cheerio

add(element: Element): Cheerio

Parameters

Returns Cheerio

add(elements: Element[]): Cheerio

Parameters

Returns Cheerio

add(selection: Cheerio): Cheerio

Parameters

  • selection: Cheerio

Returns Cheerio

addBack

addBack(): Cheerio

Returns Cheerio

addBack(filter: string): Cheerio

Parameters

  • filter: string

Returns Cheerio

addClass

addClass(classNames: string): Cheerio

Parameters

  • classNames: string

Returns Cheerio

after

after(content: string, ...contents: any[]): Cheerio

Parameters

  • content: string
  • ...contents: any[]

Returns Cheerio

after(content: Document, ...contents: any[]): Cheerio

Parameters

  • content: Document
  • ...contents: any[]

Returns Cheerio

after(content: Document[], ...contents: any[]): Cheerio

Parameters

  • content: Document[]
  • ...contents: any[]

Returns Cheerio

after(content: Cheerio, ...contents: any[]): Cheerio

Parameters

  • content: Cheerio
  • ...contents: any[]

Returns Cheerio

append

append(content: string, ...contents: any[]): Cheerio

Parameters

  • content: string
  • ...contents: any[]

Returns Cheerio

append(content: Document, ...contents: any[]): Cheerio

Parameters

  • content: Document
  • ...contents: any[]

Returns Cheerio

append(content: Document[], ...contents: any[]): Cheerio

Parameters

  • content: Document[]
  • ...contents: any[]

Returns Cheerio

append(content: Cheerio, ...contents: any[]): Cheerio

Parameters

  • content: Cheerio
  • ...contents: any[]

Returns Cheerio

appendTo

appendTo(target: Cheerio): Cheerio

Parameters

  • target: Cheerio

Returns Cheerio

attr

attr(): { [attr: string]: string }

Returns { [attr: string]: string }

attr(name: string): undefined | string

Parameters

  • name: string

Returns undefined | string

attr(name: string, value: AttrFunction): Cheerio

Parameters

Returns Cheerio

attr(name: string, value: string): Cheerio

Parameters

  • name: string
  • value: string

Returns Cheerio

attr(map: { [key: string]: any }): Cheerio

Parameters

  • map: { [key: string]: any }

Returns Cheerio

before

before(content: string, ...contents: any[]): Cheerio

Parameters

  • content: string
  • ...contents: any[]

Returns Cheerio

before(content: Document, ...contents: any[]): Cheerio

Parameters

  • content: Document
  • ...contents: any[]

Returns Cheerio

before(content: Document[], ...contents: any[]): Cheerio

Parameters

  • content: Document[]
  • ...contents: any[]

Returns Cheerio

before(content: Cheerio, ...contents: any[]): Cheerio

Parameters

  • content: Cheerio
  • ...contents: any[]

Returns Cheerio

children

children(selector?: string): Cheerio

Parameters

  • Optionalselector: string

Returns Cheerio

clone

clone(): Cheerio

Returns Cheerio

closest

closest(): Cheerio

Returns Cheerio

closest(selector: string): Cheerio

Parameters

  • selector: string

Returns Cheerio

contents

contents(): Cheerio

Returns Cheerio

css

css(propertyName?: string): string

Parameters

  • OptionalpropertyName: string

Returns string

css(propertyNames: string[]): string[]

Parameters

  • propertyNames: string[]

Returns string[]

css(propertyName: string, value: string): Cheerio

Parameters

  • propertyName: string
  • value: string

Returns Cheerio

css(propertyName: string, value: number): Cheerio

Parameters

  • propertyName: string
  • value: number

Returns Cheerio

css(
propertyName: string,
func: (index: number, value: string) => string,
): Cheerio

Parameters

  • propertyName: string
  • func: (index: number, value: string) => string

Returns Cheerio

css(
propertyName: string,
func: (index: number, value: string) => number,
): Cheerio

Parameters

  • propertyName: string
  • func: (index: number, value: string) => number

Returns Cheerio

css(properties: Object): Cheerio

Parameters

Returns Cheerio

data

data(): any

Returns any

data(name: string): any

Parameters

  • name: string

Returns any

data(name: string, value: any): any

Parameters

  • name: string
  • value: any

Returns any

each

each(func: (index: number, element: Element) => any): Cheerio

Parameters

  • func: (index: number, element: Element) => any

Returns Cheerio

empty

empty(): Cheerio

Returns Cheerio

end

end(): Cheerio

Returns Cheerio

eq

eq(index: number): Cheerio

Parameters

  • index: number

Returns Cheerio

filter

filter(selector: string): Cheerio

Parameters

  • selector: string

Returns Cheerio

filter(selection: Cheerio): Cheerio

Parameters

  • selection: Cheerio

Returns Cheerio

filter(element: Element): Cheerio

Parameters

Returns Cheerio

filter(elements: Element[]): Cheerio

Parameters

Returns Cheerio

filter(func: (index: number, element: Element) => boolean): Cheerio

Parameters

  • func: (index: number, element: Element) => boolean

Returns Cheerio

find

find(selector: string): Cheerio

Parameters

  • selector: string

Returns Cheerio

find(element: Cheerio): Cheerio

Parameters

  • element: Cheerio

Returns Cheerio

first

first(): Cheerio

Returns Cheerio

get

get(): any[]

Returns any[]

get(index: number): any

Parameters

  • index: number

Returns any

has

has(selector: string): Cheerio

Parameters

  • selector: string

Returns Cheerio

has(element: Element): Cheerio

Parameters

Returns Cheerio

hasClass

hasClass(className: string): boolean

Parameters

  • className: string

Returns boolean

html

html(): null | string

Returns null | string

html(html: string): Cheerio

Parameters

  • html: string

Returns Cheerio

index

index(): number

Returns number

index(selector: string): number

Parameters

  • selector: string

Returns number

index(selection: Cheerio): number

Parameters

  • selection: Cheerio

Returns number

insertAfter

insertAfter(content: string): Cheerio

Parameters

  • content: string

Returns Cheerio

insertAfter(content: Document): Cheerio

Parameters

  • content: Document

Returns Cheerio

insertAfter(content: Cheerio): Cheerio

Parameters

  • content: Cheerio

Returns Cheerio

insertBefore

insertBefore(content: string): Cheerio

Parameters

  • content: string

Returns Cheerio

insertBefore(content: Document): Cheerio

Parameters

  • content: Document

Returns Cheerio

insertBefore(content: Cheerio): Cheerio

Parameters

  • content: Cheerio

Returns Cheerio

is

is(selector: string): boolean

Parameters

  • selector: string

Returns boolean

is(element: Element): boolean

Parameters

Returns boolean

is(element: Element[]): boolean

Parameters

Returns boolean

is(selection: Cheerio): boolean

Parameters

  • selection: Cheerio

Returns boolean

is(func: (index: number, element: Element) => boolean): boolean

Parameters

  • func: (index: number, element: Element) => boolean

Returns boolean

last

last(): Cheerio

Returns Cheerio

map

map(func: (index: number, element: Element) => any): Cheerio

Parameters

  • func: (index: number, element: Element) => any

Returns Cheerio

next

next(selector?: string): Cheerio

Parameters

  • Optionalselector: string

Returns Cheerio

nextAll

nextAll(): Cheerio

Returns Cheerio

nextAll(selector: string): Cheerio

Parameters

  • selector: string

Returns Cheerio

nextUntil

nextUntil(selector?: string, filter?: string): Cheerio

Parameters

  • Optionalselector: string
  • Optionalfilter: string

Returns Cheerio

nextUntil(element: Element, filter?: string): Cheerio

Parameters

  • element: Element
  • Optionalfilter: string

Returns Cheerio

nextUntil(element: Cheerio, filter?: string): Cheerio

Parameters

  • element: Cheerio
  • Optionalfilter: string

Returns Cheerio

not

not(selector: string): Cheerio

Parameters

  • selector: string

Returns Cheerio

not(selection: Cheerio): Cheerio

Parameters

  • selection: Cheerio

Returns Cheerio

not(element: Element): Cheerio

Parameters

Returns Cheerio

not(func: (index: number, element: Element) => boolean): Cheerio

Parameters

  • func: (index: number, element: Element) => boolean

Returns Cheerio

parent

parent(selector?: string): Cheerio

Parameters

  • Optionalselector: string

Returns Cheerio

parents

parents(selector?: string): Cheerio

Parameters

  • Optionalselector: string

Returns Cheerio

parentsUntil

parentsUntil(selector?: string, filter?: string): Cheerio

Parameters

  • Optionalselector: string
  • Optionalfilter: string

Returns Cheerio

parentsUntil(element: Element, filter?: string): Cheerio

Parameters

  • element: Element
  • Optionalfilter: string

Returns Cheerio

parentsUntil(element: Cheerio, filter?: string): Cheerio

Parameters

  • element: Cheerio
  • Optionalfilter: string

Returns Cheerio

prepend

prepend(content: string, ...contents: any[]): Cheerio

Parameters

  • content: string
  • ...contents: any[]

Returns Cheerio

prepend(content: Document, ...contents: any[]): Cheerio

Parameters

  • content: Document
  • ...contents: any[]

Returns Cheerio

prepend(content: Document[], ...contents: any[]): Cheerio

Parameters

  • content: Document[]
  • ...contents: any[]

Returns Cheerio

prepend(content: Cheerio, ...contents: any[]): Cheerio

Parameters

  • content: Cheerio
  • ...contents: any[]

Returns Cheerio

prependTo

prependTo(target: Cheerio): Cheerio

Parameters

  • target: Cheerio

Returns Cheerio

prev

prev(selector?: string): Cheerio

Parameters

  • Optionalselector: string

Returns Cheerio

prevAll

prevAll(): Cheerio

Returns Cheerio

prevAll(selector: string): Cheerio

Parameters

  • selector: string

Returns Cheerio

prevUntil

prevUntil(selector?: string, filter?: string): Cheerio

Parameters

  • Optionalselector: string
  • Optionalfilter: string

Returns Cheerio

prevUntil(element: Element, filter?: string): Cheerio

Parameters

  • element: Element
  • Optionalfilter: string

Returns Cheerio

prevUntil(element: Cheerio, filter?: string): Cheerio

Parameters

  • element: Cheerio
  • Optionalfilter: string

Returns Cheerio

prop

prop(name: string): any

Parameters

  • name: string

Returns any

prop(name: string, value: any): Cheerio

Parameters

  • name: string
  • value: any

Returns Cheerio

remove

remove(selector?: string): Cheerio

Parameters

  • Optionalselector: string

Returns Cheerio

removeAttr

removeAttr(name: string): Cheerio

Parameters

  • name: string

Returns Cheerio

removeClass

removeClass(): Cheerio

Returns Cheerio

removeClass(className: string): Cheerio

Parameters

  • className: string

Returns Cheerio

removeClass(func: (index: number, className: string) => string): Cheerio

Parameters

  • func: (index: number, className: string) => string

Returns Cheerio

replaceWith

replaceWith(content: string): Cheerio

Parameters

  • content: string

Returns Cheerio

replaceWith(content: Element): Cheerio

Parameters

Returns Cheerio

replaceWith(content: Element[]): Cheerio

Parameters

Returns Cheerio

replaceWith(content: Cheerio): Cheerio

Parameters

  • content: Cheerio

Returns Cheerio

replaceWith(content: () => Cheerio): Cheerio

Parameters

  • content: () => Cheerio

Returns Cheerio

serialize

serialize(): string

Returns string

serializeArray

serializeArray(): { name: string; value: string }[]

Returns { name: string; value: string }[]

siblings

siblings(selector?: string): Cheerio

Parameters

  • Optionalselector: string

Returns Cheerio

slice

slice(start: number, end?: number): Cheerio

Parameters

  • start: number
  • Optionalend: number

Returns Cheerio

text

text(): string

Returns string

text(text: string): Cheerio

Parameters

  • text: string

Returns Cheerio

toArray

toArray(): Element[]

Returns Element[]

toggleClass

toggleClass(className: string): Cheerio

Parameters

  • className: string

Returns Cheerio

toggleClass(className: string, toggleSwitch: boolean): Cheerio

Parameters

  • className: string
  • toggleSwitch: boolean

Returns Cheerio

toggleClass(toggleSwitch?: boolean): Cheerio

Parameters

  • OptionaltoggleSwitch: boolean

Returns Cheerio

toggleClass(
func: (
index: number,
className: string,
toggleSwitch: boolean,
) => string,
toggleSwitch?: boolean,
): Cheerio

Parameters

  • func: (index: number, className: string, toggleSwitch: boolean) => string
  • OptionaltoggleSwitch: boolean

Returns Cheerio

val

val(): string

Returns string

val(value: string): Cheerio

Parameters

  • value: string

Returns Cheerio

wrap

wrap(content: string): Cheerio

Parameters

  • content: string

Returns Cheerio

wrap(content: Document): Cheerio

Parameters

  • content: Document

Returns Cheerio

wrap(content: Cheerio): Cheerio

Parameters

  • content: Cheerio

Returns Cheerio

Settings

Member Visibility

  • Protected
  • Inherited
  • External

ThemeOSLightDark

On This Page

Properties cheeriolength Methods [iterator]addaddBackaddClassafterappendappendToattrbeforechildrencloneclosestcontentscssdataeachemptyendeqfilterfindfirstgethashasClasshtmlindexinsertAfterinsertBeforeislastmapnextnextAllnextUntilnotparentparentsparentsUntilprependprependToprevprevAllprevUntilpropremoveremoveAttrremoveClassreplaceWithserializeserializeArraysiblingsslicetexttoArraytoggleClassvalwrap