tyxml icon indicating copy to clipboard operation
tyxml copied to clipboard

Indentation option might add an extra space

Open Julow opened this issue 4 years ago • 0 comments

The following code renders differently in the browser whether the indent option is enabled or not:

  <p>
   <span class="some padding ............................">some text here
    . and here
   </span>
  </p>

A line break is inserted between the two txt nodes. The extra breaks inside the p elements also change what C-A, C-C copies into the clipboard.

open Tyxml.Html

let content =
  html
    (head (title (txt "example")) [])
    (body
       [
         p
           [
             span
               ~a:[ a_class [ "some padding ............................" ] ]
               [ txt "some text here"; txt ". and here" ];
           ];
       ])

let () =
  Format.printf "%a" (pp ~indent:true ()) content

Julow avatar Jul 13 '21 13:07 Julow