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

(Indented) code block parsed as normal paragraph after RawBlock (Format "latex") #3947

Closed
gutinna opened this issue Sep 30, 2017 · 1 comment

Comments

@gutinna
Copy link

gutinna commented Sep 30, 2017

pandoc (1.19.2.1; debian package "compiled with pandoc-types 1.17.0.5, texmath 0.9.4.1, skylighting 0.3.3.1") parses an indented code block that follows a RawBlock (Format "latex") as a normal paragraph:

$ cat tab2.md
\newpage

	Code block

	Another Code block

$ pandoc -t native tab2.md
[RawBlock (Format "latex") "\\newpage"
,Para [Str "Code",Space,Str "block"]
,CodeBlock ("",[],[]) "Another Code block"]

This is not the case

  • with TeX code (RawInline (Format "tex"), e.g. \clearpage) instead of LaTeX code;
  • when the the indented code block is replaced by a fenced code block, or a block quote, or a list;
  • when something between the LaTeX code and the indented code block gets parsed, including an HTML comment.

Note that HTML comments are parsed as RawBlock (Format "html"). Thus not any RawBlock immediately preceding an indented code block causes this behaviour.

Ok, it's probably not the most serious bug, and the workaround (fenced code block or HTML comment) is simple. I'm still curious what causes it, though. This is as far as I got, after noticing it in PDF and HTML output.


Here's a longer example:

\hspace

	Code block

	Another Code block

\clearpage

	Code block

	Another Code block

\newpage

	Code block

	Another Code block

\section{Yes}

> Quote

> Another Quote

\newpage

~~~
Code block
~~~

Parsed:

$ pandoc -t native tab.md
[Para [RawInline (Format "tex") "\\hspace"]
,CodeBlock ("",[],[]) "Code block\n\nAnother Code block"
,Para [RawInline (Format "tex") "\\clearpage"]
,CodeBlock ("",[],[]) "Code block\n\nAnother Code block"
,RawBlock (Format "latex") "\\newpage"
,Para [Str "Code",Space,Str "block"]
,CodeBlock ("",[],[]) "Another Code block"
,RawBlock (Format "latex") "\\section{Yes}"
,BlockQuote
 [Para [Str "Quote"]]
,BlockQuote
 [Para [Str "Another",Space,Str "Quote"]]
,RawBlock (Format "latex") "\\newpage"
,CodeBlock ("",[],[]) "Code block"]
@jgm
Copy link
Owner

jgm commented Oct 3, 2017

Dev version also behaves this way.
I think I see the problem, thanks for the report!

@jgm jgm closed this as completed in 492f496 Oct 3, 2017
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

2 participants