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

Table wrapped in div does not roundtrip from html to markdown and back #4560

Closed
Zash opened this issue Apr 17, 2018 · 2 comments
Closed

Table wrapped in div does not roundtrip from html to markdown and back #4560

Zash opened this issue Apr 17, 2018 · 2 comments

Comments

@Zash
Copy link

Zash commented Apr 17, 2018

Contents of test.html:

<div class="foobar">
	<table>
		<tr><th>Foo</th></tr>
		<tr><td>Bar</td></tr>
	</table>
</div>

pandoc test.html -t markdown gives:

::: {.foobar}
  Foo
  -----
  Bar
:::

pandoc test.html -t markdown | pandoc gives:

<p>::: {.foobar} Foo —– Bar :::</p>
$ pandoc -v
pandoc 2.1.3
Compiled with pandoc-types 1.17.4.2, texmath 0.10.1.1, skylighting 0.7.0.2
Default user data directory: /home/zash/.pandoc
Copyright (C) 2006-2018 John MacFarlane
Web:  http://pandoc.org
This is free software; see the source for copying conditions.
There is no warranty, not even for merchantability or fitness
for a particular purpose.
@jgm
Copy link
Owner

jgm commented Apr 17, 2018

This is because the table parser expects a blank line after the table.
We could fix this in the reader by using a special new parser instead of blanklines. The new parser would be sensitive to the possibility that we're in a fenced div, and look ahead for the closing fence.

Alternatively, we could modify the writer to include a blank line in this context. But I think modifying the reader would make more sense.

@link2xt
Copy link
Collaborator

link2xt commented Apr 18, 2018

I solved this in Muse reader by passing terminator parser to functions that parse block series. Div parser calls block series parser with terminator parser that expects </div>, list parser uses terminator parser that expects unindented line etc.

@jgm jgm closed this as completed in bc9d296 Apr 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants