ocsigen / ocsigen/tyxml

Indentation changes rendering of <pre>

Open
#287 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
OCaml
Stars
179
Forks
63
Avg merge
5h
Merged PRs (30d)
22

Description

The following code with indentation enabled renders a line break before the closing </pre>:

    <div><p>some doc ..............................</p>
     <pre><code><span>some code of just the right length ....</span></code>
     </pre><p>some more doc</p>

This adds an extra blank line to the pre element, which renders differently whether indentation is enabled or not.

open Tyxml.Html

let content =
  html
    (head (title (txt "example")) [])
    (body
       [
         div
           [
             div
               [
                 div
                   [
                     p [ txt "some doc .............................." ];
                     pre
                       [
                         code
                           [
                             span
                               [ txt "some code of just the right length ...." ];
                           ];
                       ];
                     p [ txt "some more doc" ];
                   ];
               ];
           ];
       ])

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the provided OCaml example with pp ~indent:true and compare its output with indentation disabled. Trace the pretty-printer entry point used by pp; the issue is done when indentation no longer adds a blank line before the closing pre element.

Written by the indexing model from the issue text.

Assessment

Tech stack
ocaml
Domain
web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.