posthtml-render

  • Version 3.0.0
  • Published
  • 31.1 kB
  • 1 dependency
  • MIT license

Install

npm i posthtml-render
yarn add posthtml-render
pnpm add posthtml-render

Overview

Renders PostHTML Tree to HTML/XML

Index

Functions

function render

render: (tree?: Node | Node[], options?: Options) => string;

    Enums

    enum closingSingleTagOptionEnum

    enum closingSingleTagOptionEnum {
    tag = 'tag',
    slash = 'slash',
    default = 'default',
    closeAs = 'closeAs',
    }

      member closeAs

      closeAs = 'closeAs'

        member default

        default = 'default'

          member slash

          slash = 'slash'

            member tag

            tag = 'tag'

              enum closingSingleTagTypeEnum

              enum closingSingleTagTypeEnum {
              tag = 'tag',
              slash = 'slash',
              default = 'default',
              }

                member default

                default = 'default'

                  member slash

                  slash = 'slash'

                    member tag

                    tag = 'tag'

                      enum quoteStyleEnum

                      enum quoteStyleEnum {
                      Smart = 0,
                      Single = 1,
                      Double = 2,
                      }

                        member Double

                        Double = 2

                          member Single

                          Single = 1

                            member Smart

                            Smart = 0

                              Type Aliases

                              type Node

                              type Node =
                              | NodeText
                              | (NodeTag & {
                              closeAs?: closingSingleTagTypeEnum;
                              });

                                type Options

                                type Options = {
                                /**
                                * Custom single tags (selfClosing).
                                *
                                * @default []
                                */
                                singleTags?: Array<string | RegExp>;
                                /**
                                * Closing format for single tag.
                                *
                                * Formats:
                                *
                                * tag: `<br></br>`, slash: `<br />`, default: `<br>`
                                *
                                */
                                closingSingleTag?: closingSingleTagOptionEnum;
                                /**
                                * If all attributes should be quoted.
                                * Otherwise attributes will be unquoted when allowed.
                                *
                                * @default true
                                */
                                quoteAllAttributes?: boolean;
                                /**
                                * Replaces quotes in attribute values with `&quote;`.
                                *
                                * @default true
                                */
                                replaceQuote?: boolean;
                                /**
                                * Quote style
                                *
                                * 0 - Smart quotes
                                * <img src="https://example.com/example.png" onload='testFunc("test")'>
                                * 1 - Single quotes
                                * <img src='https://example.com/example.png' onload='testFunc("test")'>
                                * 2 - double quotes
                                * <img src="https://example.com/example.png" onload="testFunc("test")">
                                *
                                * @default 2
                                */
                                quoteStyle?: quoteStyleEnum;
                                };

                                  Package Files (1)

                                  Dependencies (1)

                                  Dev Dependencies (20)

                                  Peer Dependencies (0)

                                  No peer dependencies.

                                  Badge

                                  To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                  You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/posthtml-render.

                                  • Markdown
                                    [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/posthtml-render)
                                  • HTML
                                    <a href="https://www.jsdocs.io/package/posthtml-render"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>