Bookdown: Line breaks before math in Safari

When viewing a Bookdown book in the Safari browser, sometime a line break wrongly appears directly before inline math. The place I most often notice this is in second-or-later paragraphs within theorem-like environments.

Here's an example:

---
site:   bookdown::bookdown_site
output: bookdown::gitbook
---

```{theorem}
We have $a$ and $b$ and $c$.

We also have $d$ and $e$ and $f$.
```

In Chrome this looks as it should, but in Safari, some line breaks appear where they shouldn't:

Is there a way to fix this, or is it the browser's fault?

[Edit: Escaped my back-ticks properly.]

There must be something different in the CSS applied by browser if you don't get the same result between two browsers.

Can you try a new feature from bookdown 0.21

::: {.theorem}
We have $a$ and $b$ and $c$.

We also have $d$ and $e$ and $f$.
:::

This is the new way for those environment - it uses Pandoc's fenced div to build custom block and we added support for bookdown's special env: bookdown/NEWS.md at main · rstudio/bookdown · GitHub

I am curious if Pandoc processing will solve this issue . Can you try ? Thanks!

About that: FAQ: How to format your code

1 Like

Yes! The ::: {.theorem} method displays correctly in Safari. Thanks!

1 Like

Great !

We made the new syntax to work specifically to improve the support of markdown syntax inside the block !

Glad it works!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.