Comments (7)
Here: https://bookdown.org/yihui/bookdown/markdown-extensions-by-bookdown.html#text-references it states that "The text can contain anything that Markdown supports, as long as it is one single paragraph."
In markdown (at least the flavour used by bookdown) sentences belonging to the same paragraph can be each in its own line. You need two newlines to define a new paragraph. (You can see that in the bad example, the text reference is rendered as a single paragraph).
Also, PDF output does work. This seems to be an issue for HTML (gitbook and epub) and word formats only.
from bookdown.
@eliocamp: Do you mind linking the documentation you mentioned? I always assumed this was by design. Either way, I can definitely confirm the behaviour you describe for as long as I remember using text references.
from bookdown.
The issue is around here:
Lines 807 to 821 in 52c31aa
At this point x
has one element per line instead of one element per paragraph; like this:
<p>(ref:caption) Here is a nice figure!
And this is a second sentence.</p>
So grep(r, x)
doesn't find it (the line doesn't match r = "^<p>(\\(ref:[-/[:alnum:]]+\\)) (.+)</p>$"
). The fix might be to join each p
block in its own line, but I don't know if that could break other stuff.
Using --wrap none
here actually solves the issue, but it might create others.
Lines 80 to 82 in 52c31aa
from bookdown.
Ok. It seems that --warp=preserve
was introduced to fix #504. But that's only related to LaTeX, which doesn't have this problem.
Removing this option only for HTML documents seems to solve the issue in HTML and all tests pass (at least locally on my machine).
That would just pass pandoc_args
directly in all HTML functions instead of passing it through pandoc_args2()
. For instance, in this line:
Lines 59 to 62 in 52c31aa
As a workaround, one can set
pandoc_args:
- --wrap=none
on the output format options in the YAML.
Don't know how you feel about this. If you agree with the fix, I can sent a PR.
from bookdown.
Thanks for the investigation. I think we should have used --wrap=none
for HTML output instead of --preserve
.
This is part of change in HTML output with pandoc 2.17 where wrap has now effect.
I wanted to do that in #1304 but preserve
was already set. You reminded us why (#504)
from bookdown.
I've got a similar issue when embedding \n
's in fig.cap
: the Figure x.y
caption prefix is not resolved. Is this related or is it a separate issue?
from bookdown.
@king-of-poppk please open a new issue with a reproducible example and we can have a look
from bookdown.
Related Issues (20)
- Search in bs4_book often missing results HOT 6
- [FR] Two-column layout for .docx files HOT 1
- [FR] More flexible table of contents in tufte_html_book HOT 4
- How could I add a link for the "Edit" icon to private Bitbucket repo? HOT 11
- .unlisted and .unnumbered not excluding tagged headers from TOC HOT 5
- [FR] Add support for the YALM setting "language: ui: references_name" to change the title of references section in html output HOT 7
- Image embeded in flextable lost in .docx output HOT 3
- [FR] Typst Support HOT 3
- Equation in book is broken HOT 3
- [FR] Allow to use `$$` for numbering equation in **bookdown**
- R4.3 error if multiple files are passed to `render_book` without an `output_format` specified HOT 2
- crosstalk html widget doesn't display the figure caption HOT 3
- html output error with echo=FALSE option HOT 1
- [FR] Multi language support
- Square brackets around citations in text HOT 2
- Cannot generate pdf via "server" but only html despite I tried probably all suggestions. HOT 4
- Use of 'tab.scap.' for tables? (Non kable() users!) HOT 2
- Hyphenation only works in English HOT 17
- bs4_book - references by chapter not displaying HOT 1
- The manual's recommendation of only previewing the web version is dangerous. HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bookdown.