Documentation - v0.27.1
    Preparing search index...

    Variable htmlConst

    html: {
        escape: typeof escape;
        unparse: typeof unparse;
        (
            strings: TemplateStringsArray,
            ...sub: (
                number
                | boolean
                | Long
                | InputText
                | MessageEntity
                | null
                | undefined
            )[],
        ): TextWithEntities;
        (string: string): TextWithEntities;
    } = ...

    Type Declaration

      • (
            strings: TemplateStringsArray,
            ...sub: (
                number
                | boolean
                | Long
                | InputText
                | MessageEntity
                | null
                | undefined
            )[],
        ): TextWithEntities
      • Tagged template based HTML-to-entities parser function

        Additionally, md function has two static methods:

        • html.escape - escape a string to be safely used in HTML (should not be needed in most cases, as html function itself handles all strings passed to it automatically as plain text)
        • html.unparse - add HTML formatting to the text given the plain text and entities contained in it

        Parameters

        Returns TextWithEntities

        const text = html`<b>${user.displayName}</b>`
        
      • (string: string): TextWithEntities
      • A variant taking a plain JS string as input and parsing it.

        Useful for cases when you already have a string (e.g. from some server) and want to parse it.

        Parameters

        • string: string

        Returns TextWithEntities

        const string = '<b>hello</b>'
        const text = html(string)
    • escape: typeof escape
    • unparse: typeof unparse