-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Code blocks not rendering properly in reStructuredText #3496
Comments
what pandoc version are you using? |
In (1), you have a space at the beginning because there are spaces after the In (2), your Have you tried looking at the XHTML snippet you posted in a browser? You'll see that indeed, the first line is indented. Our RST output respects that; your suggested output does not. Summary: the only problem I see here is with case (1), where evidently we need to do some kind of escaping of the initial space (advice welcome). |
@jgm, In (1), there are no spaces after the In regard to case (2): yes, I used to make a living off of living, breathing, and sleeping XML so I see a problem with case (1) and case (2); in terms of HTML, that's a different story altogether. :) As far as recommendations from my perspective:
|
|
Re (1), open this in a browser, you'll see that the code doesn't start right after BEFORE, but on the next line.
so the newline after the Re (2), well, pandoc is parsing this as HTML, so it's the HTML rules that matter. Any pretty-printer that introduces spaces between the pre tag and the code tag is changing the HTML meaning of the document. What you could help us with is how to represent a code span starting with a space (or for that matter, newline) character in reStructuredText. I couldn't see a way to do it from my brief perusal of the documentation. If there's no way to do it, we could simply remove the space, or leave things as they are. |
What do you mean? Yes it should, see e.g. http://stackoverflow.com/questions/588356/why-does-the-browser-renders-a-newline-as-space |
There are several issues when converting XHTML to reStructuredText so I will try to elaborate on any/all of them.
<code />
block, the rST code block contains a preceding space which causes rST not to render the code block as a code block. Newlines are also not preserved.Example XHTML:
Resulting rST:
<code />
block within<pre />
, newlines are preserved but the preceding space throws off the rendered rST.Example XHTML:
Resulting rST:
Where the hell are all of these mysterious spaces coming from?! The code lines are indented with 4 spaces but where the hell do the additional 6 spaces come from in the first line? It's certainly not from the XHTML. Looking at the XHTML, the
<code />
block is indented with 6 spaces but then why take<pre />
literally while stripping out<code />
? It doesn't really make sense and the behavior is inconsistent with item 1 vs item 2.(NOTE: note the empty lines as well)
Because of formatting issues like this, I need to go and read what I already converted and use a series of regular expressions to parse my rST document and fix what was converted. This makes for a sad panda.
The text was updated successfully, but these errors were encountered: