Documentation

Lean.Data.Html.Basic

inductive Lean.Html :

HTML content, which may be either a single node or a sequence of sibling nodes.

This type is optimized for convenient authoring of HTML documents. It is not formally related to the HTML DOM representation. It is analogous to React's Fragment.

  • element (tag : String) (attrs : Array (String × String)) (children : Html) : Html

    An element with the given tag name, attributes, and children.

  • text : String → Html

    Textual content.

    The characters &, <, and > are always escaped to HTML entities during rendering. Use raw in raw text elements (script and style) instead.

  • raw : String → Html

    Characters to be copied verbatim (and not escaped) during rendering.

  • seq : Array Html → Html

    A sequence of HTML values.

Instances For
    @[instance_reducible]
    @[instance_reducible]
    @[instance_reducible]
    @[instance_reducible]
    @[instance_reducible]
    @[instance_reducible]

    Empty HTML.

    Instances For
      @[irreducible]

      Whether this HTML is rendered as the empty string.

      Instances For
        def Lean.Html.ofString (escape : Bool) :

        If escape is true, then characters such as & are escaped to entities such as &amp; during rendering.

        Use false in raw text elements (script and style).

        Instances For
          @[instance_reducible]

          Appends two HTML forests.

          Instances For
            @[instance_reducible]
            def Lean.Html.ofCollection {ρ : Type w} [ForIn Id ρ Html] (hs : ρ) :

            Merges a collection of HTML values by appending them.

            Like seq (ForIn.toArray hs), but may produce a more compact representation.

            Instances For

              Merges an array of HTML values by appending them.

              Like seq, but may produce a more compact representation.

              Instances For

                Merges a list of HTML values by appending them.

                Like seq hs.toArray, but may produce a more compact representation.

                Instances For

                  Returns the given HTML, or empty when the input is none.

                  Instances For
                    @[instance_reducible]
                    @[instance_reducible]
                    @[instance_reducible]
                    @[instance_reducible]

                    A compact JSON encoding of Html.

                    @[irreducible]
                    Instances For
                      @[instance_reducible]
                      @[instance_reducible]
                      partial def Lean.Html.rewritePostM {m : Type → Type u_1} [Monad m] (fn : Html → m Html) :
                      Html → m Html

                      Rewrites the forest by using fn to transform every node. Traversal proceeds in post-order: fn receives element and seq nodes with already-rewritten children.

                      def Lean.Html.rewritePost (fn : Html → Html) (h : Html) :

                      Rewrites the forest by using fn to transform every node. Traversal proceeds in post-order: fn receives element and seq nodes with already-rewritten children.

                      Instances For