r - RMarkdown: preserve source code formatting in code cell -
my rmarkdown source looks (screenshot rstudio):
when press ctrl+shift+k
got view expected (with empty lines). however, if run chunk (evaluate) , compile (ctrl+shift+k
), get:
is there way how preserve empty lines in source code? (i checked knitr options: strip.white=false, tidy=true, tidy.opts=list(blank=true)
no joy.)
i'm using rstudio 1.0.153
other info:
sessioninfo() r version 3.4.1 (2017-06-30) platform: x86_64-pc-linux-gnu (64-bit) running under: debian gnu/linux 9 (stretch) matrix products: default blas: /usr/lib/openblas-base/libblas.so.3 lapack: /usr/lib/libopenblasp-r0.2.19.so locale: [1] lc_ctype=en_us.utf-8 lc_numeric=c [3] lc_time=en_us.utf-8 lc_collate=en_us.utf-8 [5] lc_monetary=en_us.utf-8 lc_messages=en_us.utf-8 [7] lc_paper=en_us.utf-8 lc_name=c [9] lc_address=c lc_telephone=c [11] lc_measurement=en_us.utf-8 lc_identification=c attached base packages: [1] stats graphics grdevices utils datasets methods base other attached packages: [1] rvest_0.3.2 xml2_1.1.1 dplyr_0.7.1 purrr_0.2.2.2 [5] readr_1.1.1 tidyr_0.6.3 tibble_1.3.3 ggplot2_2.2.1 [9] tidyverse_1.1.1 loaded via namespace (and not attached): [1] pbdzmq_0.2-6 reshape2_1.4.2 haven_1.1.0 lattice_0.20-35 [5] colorspace_1.3-2 htmltools_0.3.6 yaml_2.1.14 base64enc_0.1-3 [9] xml_3.98-1.9 rlang_0.1.1 foreign_0.8-69 glue_1.1.1 [13] selectr_0.3-1 readxl_1.0.0 modelr_0.1.0 semver_0.2.0 [17] bindrcpp_0.2 bindr_0.1 plyr_1.8.4 stringr_1.2.0 [21] cellranger_1.1.0 munsell_0.4.3 binman_0.1.0 gtable_0.2.0 [25] catools_1.17.1 psych_1.7.5 evaluate_0.10.1 knitr_1.16 [29] forcats_0.2.0 wdman_0.2.2 curl_2.7 parallel_3.4.1 [33] broom_0.4.2 rcpp_0.12.11 openssl_0.9.6 backports_1.1.0 [37] scales_0.4.1 formatr_1.5 rselenium_1.7.1 jsonlite_1.5 [41] mnormt_1.5-5 hms_0.3 digest_0.6.12 stringi_1.1.5 [45] grid_3.4.1 rprojroot_1.2 tools_3.4.1 bitops_1.0-6 [49] magrittr_1.5 lazyeval_0.2.0 pkgconfig_2.0.1 lubridate_1.6.0 [53] httr_1.2.1 assertthat_0.2.0 rmarkdown_1.6 r6_2.2.2 [57] nlme_3.1-131 compiler_3.4.1
as far can see, can't html notebook. if don't need special notebook features, can ask html_document
instead of html_notebook
, formatting preserved. if need notebook features, need make feature request on rmarkdown
development page https://github.com/rstudio/rmarkdown add this.
Comments
Post a Comment