Skip to content

Eating up first newline in HTML <pre> tag #11064

@thisisanex-parrot

Description

@thisisanex-parrot

Problem:
Converting from HTML to HTML or HTML to Markdown it appears that the first newline in the <pre> tag gets removed. I believe this is a bug since the first input example will properly render a newline before foo in multiple browser.

I have also found that converting docx to html can accurately produce a similar output to the first input example.

Input Example 1:

<p><span>hi</span></p>
<pre><code>
foo

bar</code></pre>

Input Example 2:

<p><span>hi</span></p>
<pre><code>foo

bar</code></pre>

pandoc --from html --to html5 --wrap=preserve --no-highlight

Output Example HTML 1:

<p><span>hi</span></p>
<pre><code>foo

bar</code></pre>

Output Example HTML 2:

<p><span>hi</span></p>
<pre><code>foo

bar</code></pre>

pandoc --from html --to markdown --wrap=preserve --no-highlight

Output Example Markdown 1:

hi

    foo

    bar

Output Example Markdown 2:

hi

    foo

    bar

Pandoc Version:
Tested on 3.6-3.7.0.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions