Skip to content
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

Uses wrap = none for HTML output #1432

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion R/bs4_book.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ bs4_book <- function(theme = bs4_book_theme(),
self_contained = FALSE,
theme = NULL,
template = template,
pandoc_args = pandoc_args2(pandoc_args),
pandoc_args = pandoc_args2(pandoc_args, wrap = 'none'),
lib_dir = lib_dir,
extra_dependencies = c(bs4_book_dependency(theme), extra_dependencies),
...
Expand Down
2 changes: 1 addition & 1 deletion R/ebook.R
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ process_markdown = function(
on.exit(file.remove(intermediate_html), add = TRUE)
rmarkdown::pandoc_convert(
input_file, 'html', from, intermediate_html, TRUE,
c(pandoc_args2(pandoc_args), '--section-divs', '--mathjax', '--number-sections')
c(pandoc_args2(pandoc_args, wrap = 'none'), '--section-divs', '--mathjax', '--number-sections')
)
x = read_utf8(intermediate_html)
x = clean_html_tags(x)
Expand Down
2 changes: 1 addition & 1 deletion R/gitbook.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ gitbook = function(
toc = TRUE, number_sections = number_sections, fig_caption = fig_caption,
self_contained = self_contained, anchor_sections = anchor_sections,
lib_dir = lib_dir, theme = NULL, extra_dependencies = extra_dependencies,
template = template, pandoc_args = pandoc_args2(pandoc_args), ...
template = template, pandoc_args = pandoc_args2(pandoc_args, wrap = 'none'), ...
)
config$pandoc$lua_filters = append(config$pandoc$lua_filters, lua_filters)
split_by = match.arg(split_by)
Expand Down
8 changes: 4 additions & 4 deletions R/html.R
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ html_chapters = function(
config = get_base_format(base_format, list(
toc = toc, number_sections = number_sections, fig_caption = fig_caption,
self_contained = FALSE, lib_dir = lib_dir,
template = template, pandoc_args = pandoc_args2(pandoc_args), ...
template = template, pandoc_args = pandoc_args2(pandoc_args, wrap = 'none'), ...
))
split_by = match.arg(split_by)
post = config$post_processor # in case a post processor have been defined
Expand All @@ -77,8 +77,8 @@ html_chapters = function(

# add --wrap=preserve to pandoc args for pandoc 2.0:
# https://github.com/rstudio/bookdown/issues/504
pandoc_args2 = function(args) {
if (pandoc2.0() && !length(grep('--wrap', args))) c('--wrap', 'preserve', args) else args
pandoc_args2 = function(args, wrap = 'preserve') {
if (pandoc2.0() && !length(grep('--wrap', args))) c('--wrap', wrap, args) else args
}

#' @rdname html_chapters
Expand Down Expand Up @@ -135,7 +135,7 @@ html_document2 = function(
pandoc_args = NULL, base_format = rmarkdown::html_document
) {
config = get_base_format(base_format, list(
..., number_sections = number_sections, pandoc_args = pandoc_args2(pandoc_args)
..., number_sections = number_sections, pandoc_args = pandoc_args2(pandoc_args, wrap = 'none')
))
post = config$post_processor # in case a post processor have been defined
config$post_processor = function(metadata, input, output, clean, verbose) {
Expand Down
2 changes: 1 addition & 1 deletion R/latex.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pdf_book = function(
) {
config = get_base_format(base_format, list(
toc = toc, number_sections = number_sections, fig_caption = fig_caption,
pandoc_args = pandoc_args2(pandoc_args), ...
pandoc_args = pandoc_args2(pandoc_args, wrap = "preserve"), ...
))
config$pandoc$ext = '.tex'
post = config$post_processor # in case a post processor have been defined
Expand Down