Skip to content

[Unreleased] Ocaml library to pretty print/format HTML5. See notes in README.

License

Notifications You must be signed in to change notification settings

lemaetech/pp_html

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pretty-printer, formatter for HTML5 (Unreleased and not production ready)

Note - The parser hasn't been validated against HTML5 RFC.

Example

let () =
  let html = 
    {|<!DOCTYPE html><html><body><br> 
    <hr class="class1" id="id1"/>
    <!-- This is a comment --> 
     <div class="class1"     id ='id1' style="align: center" enabled>Hello World!</div>
     <div></div>
     <div disabled id   =   hello id = 
      hello2 id3 = 
       hello3></div>
    </body></html>|} in 
  Pp_html.parse html
  |> Pp_html.pp ~indent:4 Format.std_formatter
;;

The above code produces the following formatted HTML5.

<!DOCTYPE html>

<html>
    <body>
        <br />
        <hr class="class1"
            id="id1"/>

        <!--  This is a comment  -->
        <div class="class1"
             id="id1"
             style="align: center"
             enabled>
            Hello World!
        </div>
        <div>
        </div>
        <div disabled
             id="hello"
             id="hello2"
             id3="hello3">
        </div>
    </body>
</html>

About

[Unreleased] Ocaml library to pretty print/format HTML5. See notes in README.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published