Skip to content

Margin/div bug when rendering gitbook #733

@varemo

Description

@varemo

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:

---
title: "Title"
---

# Title

test

## Section 1

test
```{r}
1+1
```

## Section 2

test

## Section 3

test
```{r}
2+2
```

## Section 4

test

image


By filing an issue to this repo, I promise that

  • I have fully read the issue guide at https://yihui.name/issue/.
  • I have provided the necessary information about my issue.
    • If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.
    • If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included 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').
    • If I have posted the same issue elsewhere, I have also mentioned it in this issue.
  • I have learned the Github Markdown syntax, and formatted my issue correctly.

I understand that my issue may be closed if I don't fulfill my promises.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions