Skip to content

specially() + HTML report can't handle ampersands in function code #661

@william-l-barcelona-fr

Description

@william-l-barcelona-fr

Description

I am running into a KaTeX parse error when trying to show an interrogation report when using a function in specially() that includes an ampersand for logical operations. I am able to run the interrogation fine if I don't want to make the HTML report.

Reproducible example

library(pointblank)

create_agent(mtcars) |>
  specially(fn = function(x) x$mpg > 10 & x$cyl < 2) |>
  interrogate()
── Interrogation Started - there is a single validation step ─────────────────────────────────────────────
✔ Step 1: OK.

── Interrogation Completed ───────────────────────────────────────────────────────────────────────────────
Error: ParseError: KaTeX parse error: Expected 'EOF', got '&' at position 5: mpg &̲gt; 10 &amp; x

Expected result

I would have expected a report to be generated with no errors.

Session info

R version 4.4.1 (2024-06-14)
Platform: x86_64-ubuntu18-linux-gnu
Running under: Ubuntu 18.04.6 LTS

Matrix products: default
BLAS/LAPACK: /apps/intel/2019.1/compilers_and_libraries_2019.1.144/linux/mkl/lib/intel64_lin/libmkl_gf_lp64.so;  LAPACK version 3.7.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8       
 [4] LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

time zone: America/New_York
tzcode source: system (glibc)

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] pointblank_0.12.2 MKLthreads_0.1   

loaded via a namespace (and not attached):
 [1] vctrs_0.6.5       cli_3.6.3         gt_0.11.1         rlang_1.1.4       xfun_0.45        
 [6] generics_0.1.3    jsonlite_1.8.9    glue_1.8.0        V8_6.0.0          markdown_1.11    
[11] htmltools_0.5.8.1 sass_0.4.9        fansi_1.0.6       tibble_3.2.1      fastmap_1.2.0    
[16] lifecycle_1.0.4   compiler_4.4.1    dplyr_1.1.4       Rcpp_1.0.13-1     pkgconfig_2.0.3  
[21] rstudioapi_0.16.0 katex_1.5.0       blastula_0.3.5    digest_0.6.36     R6_2.5.1         
[26] tidyselect_1.2.1  utf8_1.2.4        curl_5.2.2        pillar_1.9.0      commonmark_1.9.1 
[31] magrittr_2.0.3    tools_4.4.1       withr_3.0.2       xml2_1.3.6 

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions