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

caption trimmed when using minor sign (<) #368

Closed
mafed opened this issue Apr 3, 2019 · 3 comments
Closed

caption trimmed when using minor sign (<) #368

mafed opened this issue Apr 3, 2019 · 3 comments

Comments

@mafed
Copy link

mafed commented Apr 3, 2019

Description
When using the minor sign < in a kable caption kable_styling() cuts off everything after that symbol. Is there a way to avoid it?

To Reproduce

library(knitr)
library(kableExtra)
library(stringr)

example <- mtcars %>% 
  head(n = 3) %>% 
  kable(caption = paste0("Caption trimmed when ",
                         "using the minor sign. ",
                         "After this sentence nothing printed. ",
                         "< 'other text', `verb text`")) 
## kable preserves caption in HTML format
str_sub(example, end = 200) %>% 
  cat()
## kable_styling removes everything after the minor sign
example %>% 
  kable_styling()

Here's my sessionInfo()

R version 3.5.1 (2018-07-02)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux

Matrix products: default
BLAS/LAPACK: /usr/lib64/libopenblas-r0.2.20.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8   
 [6] LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                  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] stringr_1.4.0    kableExtra_1.1.0 knitr_1.22   

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.1        rstudioapi_0.10   xml2_1.2.0        magrittr_1.5      hms_0.4.2         tidyselect_0.2.5  rvest_0.3.2      
 [8] munsell_0.5.0     viridisLite_0.3.0 colorspace_1.4-1  R6_2.4.0          rlang_0.3.2       dplyr_0.8.0.1     highr_0.7        
[15] httr_1.4.0        tools_3.5.1       webshot_0.5.1     xfun_0.5          htmltools_0.3.6   assertthat_0.2.1  yaml_2.2.0       
[22] digest_0.6.18     tibble_2.1.1      crayon_1.3.4      purrr_0.3.2       readr_1.3.1       glue_1.3.1        evaluate_0.13    
[29] rmarkdown_1.12    stringi_1.4.3     compiler_3.5.1    pillar_1.3.1      scales_1.0.0      pkgconfig_2.0.2  
@mafed mafed changed the title caption trimmed when using minor sign (<) caption trimmed when using minor sign (<) Apr 3, 2019
@haozhu233
Copy link
Owner

haozhu233 commented Apr 3, 2019 via email

@mafed
Copy link
Author

mafed commented Apr 3, 2019

Thanks for the quick reply @haozhu233 but it doesn't work (I tried that already).
Curiously, the greater sign > is kept as verbatim by kable() and then correctly converted to &gt; by kable_styling().
To me this suggests there is an automatic caption parsing but doesn't check for < (but checks for >).

@haozhu233
Copy link
Owner

I see. Are we talking about html or latex?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants