-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
raw_attribute not written by the markdown writer #4311
Comments
The problem is that we can't tell from the AST whether you
originally wrote
`\foo`{=latex}
or just
\foo
since both get parsed as a raw LaTeX element.
The writer has to pick one rendering. One option would be
always to pick the explicit raw attribute form if the
raw_attribute extension is enabled. But this might give
some unexpected results for a lot of people, especially
since this attribute is set by default...
|
I did not fully understand the rationale behind it. From the manual:
Hence, it becomes mandatory to mark up at least raw code in header-includes with the raw attribute. That is what I did. Nevertheless, the header-includes should not be repeated outside of the yaml block. Even if it does not make much sense at all, |
This is because the default markdown template includes a variable to be filled with the contents of You can always remove this variable from your markdown template. |
I think that using the explicit raw attribute for all raw content, if the extension is enabled, is the way to go. |
I just ran across a variation on this in pandoc 2.2. When round-tripping markdown ( Markdown example: \newcommand{\code}[1]{`#1`{.lang}}
BEFORE \code{x} AFTER
BEFORE `` `x`{.lang}``{=latex} AFTER Output of \newcommand{\code}[1]{`#1`{.lang}}
BEFORE `x`{.lang} AFTER
BEFORE `x`{.lang} AFTER If this is then piped through \newcommand{\code}[1]{`#1`{.lang}}
BEFORE \texttt{x} AFTER
BEFORE \texttt{x} AFTER Meanwhile, sending the original markdown straight to LaTeX with \newcommand{\code}[1]{`#1`{.lang}}
BEFORE `x`{.lang} AFTER
BEFORE `x`{.lang} AFTER |
with pandoc 2.1.1 and a file
header_with.md
with content:and
pandoc -s -t native header_with.md
prints:but the raw attribute is removed if
pandoc -s -t markdown header_with.md
gets called:It does not matter if I explicitly enable the
raw_attribute
extension for the input or output format.Not only the raw attribute
{=latex}
gets removed, also the complete line\usepackage{todonotes}
gets duplicated and printed after the yaml header.The text was updated successfully, but these errors were encountered: