-
-
Notifications
You must be signed in to change notification settings - Fork 980
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
HTML output of Stan chunks can be malformed #907
Comments
@yihui Any idea why this might be the case? |
FWIW I was able to repro this trivially (had rmarkdown 1.2.9000 and knitr 1.15.1 locally). I wonder if it's actually a bug in the highlighter as the output from knitr looks fine prior to the highlight pass (HTML entities properly escaped):
|
I just tested it, and I think it is a highlight.js bug. We are still using 1.1, and the official version is 9.8.0 now: https://highlightjs.org/ I tested 9.8.0 and it works fine. |
We could test this by changing the highligher to one of the pandoc based
ones (the "default" and "textmate" highlighters use highlight.js, the other
highlighters use pandoc)
…On Tue, Dec 13, 2016 at 4:50 PM, Jonathan ***@***.***> wrote:
FWIW I was able to repro this trivially (had rmarkdown 1.2.9000 and knitr
1.15.1 locally). I wonder if it's actually a bug in the highlighter as the
output from knitr looks fine prior to the highlight pass (HTML entities
properly escaped):
<pre class="stan"><code>parameters {real <lower = 0> theta;}
model {target += exponential_lpdf(theta | 1);}</code></pre>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#907 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAGXx60f-9rwYrL1-jCQYEkIXPCuJeiHks5rHxMVgaJpZM4LMNQU>
.
|
For now I'd say the workaround is to change the highlighter to "tango", "pygments", "kate", "monochrome", "espresso", "zenburn", or "haddock" |
Duplicate of #988. |
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary. |
With RStudio >= 1.0, when knitting a RMarkdown file to HTML, a chunk with Stan code can render improperly unless extra spacing is included.
For example, this chunk
looks okay when knit to HTML.
However, without the extra space before and after the angle brackets, as in
the HTML file omits the <.
Similarly, without the extra spaces before and after the equal sign, as in
the HTML omits the first =.
If you knit to PDF, none of these problems occur, so I think it is probably as issue that
<
and>
need to be interpreted literally in the HTML. The Stan language is whitespace insensitive, so it is a bit odd to have to add extra whitespace to get decent HTML output.The text was updated successfully, but these errors were encountered: