-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
Margin/div bug when rendering gitbook #733
Comments
I am having the same problem. It is also visible in the bookdown-demo. Making no changes to the bookdown-demo repo I can confirm this problem. Compare https://bookdown.org/yihui/bookdown-demo/intro.html to https://jwbowers.github.io/bookdown-demo/intro.html . This problem does not appear when making pdf documents. I haven't checked epub. It appears that something happens to the html after some R output is created. The example above occurs after a few output chunks. In the bookdown-demo example, it occurs after the first output chunk.
|
I confirm that downgrading to version .7 worked. I can also confirm that versions .9, .10, .11, and .11.1 all have this problem. |
This is awesome, I feel so much better since other people starting to hit this issue. I didn't posted on gitissue since the message (when you want to post on gitissues) told me to try other places fist. I have here - Rstudio Community Exactly the same issue! I think the issue is with both pandoc and bookdown have lost sync..? Looking forward for a fix just FYI I've set up a quick test git repo, so that people can git clone and tested it out on they machine to give quick yay or nay. cheers |
@jwbowers and @varemo if you keep latest bookdown (0.11) and downgrade to pandoc 2.6 it sort of works. As per Rstudio Comminuty discussion - my more complicated Rmd still doesn't compile properly. |
Following @jwbowers , @varemo and @serine , I've inspected the difference between the markups generated by Pandoc 2.7.2 and Pandoc 2.7.3. The markup generated by bookdown with Pandoc 2.7.3 is invalid. I think the problem may come from the skylighting library: Pandoc 2.7.2 uses skylighting 0.7.7 and Pandoc 2.7.3 uses skylighting 0.8.1. For instance, if we take these simple markdown lines:
With Pandoc 2.7.2, the (here, beautified) markup is: <div class="sourceCode" id="cb1">
<pre class="sourceCode r">
<code class="sourceCode r">
<a class="sourceLine" id="cb1-1" title="1">
<span class="kw">print</span>
(<span class="st">"hello"</span>)
</a>
</code>
</pre>
</div> With Pandoc 2.7.3, we get a new (also beautified) markup: <div class="sourceCode" id="cb1">
<pre class="sourceCode r">
<code class="sourceCode r">
<span id="cb1-1">
<a href="#cb1-1"></a>
<span class="kw">print</span>
(<span class="st">"hello"</span>)
</span>
</code>
</pre>
</div> My guess is that this new markup cleaned by bookdown leads to an invalid HTML document. I am not familiar with all the cleaning operations made internally by bookdown but I wonder whether the Lines 1011 to 1018 in 2c97ef3
I haven't had time for further investigations. I hope it can help. |
@RLesur This is extremely helpful. I believe you have done 90% of the work. I'll try to finish the rest 10%. Thanks a lot! |
The 10% work was as simple as removing four characters :) Please test the current development version of bookdown: remotes::install_github('rstudio/bookdown') Let me know if the problem persists. Thanks a lot! |
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. |
I have encountered a problem with rendering a book in the gitbook format (
bookdown::render_book('file.Rmd')
). What happens is that the final HTML is looking fine down to "Section 4" (in my example below). This section is not indented/aligned with the other text but rather starts directly to the right of the sidebar, without any margins. I don't understand why it happens at Section 4 and not also Section 2.If I add
echo=FALSE
to the last code chunk, this problem goes away.I have played around with countless modifications of the file below trying to figure out what is causing this but failed to understand. I suspect that it is div tags that are not created correctly, judging by looking at the resulting html files.
A final note is that this was done with bookdown version 0.11, and it seems like the issue is also in 0.10. I downgraded to 0.7 and that resolved the problem.
file.Rmd:
By filing an issue to this repo, I promise that
xfun::session_info('bookdown')
. I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version:remotes::install_github('rstudio/bookdown')
.I understand that my issue may be closed if I don't fulfill my promises.
The text was updated successfully, but these errors were encountered: