Jesse Cambon
Jesse Cambon

Reputation: 355

Suppress line breaks created by RMarkdown

I am using a Rmarkdown (.Rmd) document to generate a markdown (.md) document for use with a Jekyll blog. I use knitr to create the .md file from the .Rmd file and there are additional line breaks in the .md file that were not in the original .Rmd document. These line breaks are not visible when the post displays on my Jekyll blog, but unfortunately the line breaks are visible when the post displays on R-Bloggers.

Is there a way I can configure my knit settings so that additional line breaks are not created when generating my .md document? Links to my Rmarkdown and outputted Markdown file are below for reference.

EDIT - Note that the files linked to below are now updated with the pandoc_args solution suggested below. Before the pandoc_args argument was added to the YAML, the .md file had extra line breaks.

Upvotes: 4

Views: 1022

Answers (1)

Ralf Stubner
Ralf Stubner

Reputation: 26833

These line breaks are (probably) caused by pandoc and can be controlled with the --wrap option. You should use --wrap=none or --wrap=preserve. You can specify such options in the YAML header:

output:
  md_document:
    pandoc_args: ["--wrap=preserve"]

Upvotes: 4

Related Questions