Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pandoc turns self-closing inline <hr/> tags into opening+closing pairs #1420

Closed
elmimmo opened this issue Jul 13, 2014 · 0 comments
Closed

Comments

@elmimmo
Copy link

elmimmo commented Jul 13, 2014

When converting to EPUB 3, Pandoc converts inline hr tags in markdown documents into a pair that opens and closes. This does not seem to happen when converting to a plain HTML snippet.

Even though most of the times inlining an HTML hr tag in markdown will be pointless as markdown does have a native syntax for an equivalent, it will be necessary to do so if we need the tag in the output HTML to have a class attribute.

While no web engine that I know of will have problems rendering that, that deviation from what the HTML specification says of hr brings no benefit, and Kindlegen (Amazon's tool for converting EPUB into their Mobipocket format) will produce warning messages about it being an "invalid tag", polluting the conversion report.

Steps to reproduce:

Having the following source document sample.txt:

This is paragraph no. 1.

---

This is a 2nd paragraph.

<hr class="tall" />

And this one is the last paragraph.
  1. Convert it to EPUB 3 with the following command:
pandoc -f markdown -t epub3 -o sample.epub sample.txt
  1. Then convert it to an HTML snippet to stdout with the following command:
cat sample.txt | pandoc

Expected results

Both 1 & 2 should have produce the following snippet (leaving aside the EPUB 3's extra wrapping boilerplate and meaningless whitespace differences):

<p>This is paragraph no. 1.</p>
<hr />
<p>This is a 2nd paragraph.</p>
<hr class="tall" />
<p>And this one is the last paragraph.</p>

Actual results

While such is the result in the case of 2, EPUB 3's output (i.e. 1) has had the tag <hr class="tall" /> converted into <hr class="tall"></hr>:

<p>This is paragraph no. 1.</p>
<hr />
<p>This is a 2nd paragraph.</p>
<hr class="tall"></hr>
<p>And this one is the last paragraph.</p>
@jgm jgm closed this as completed in cb62cd0 Jul 13, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant