options(stringr.html = TRUE) not working

Hi everybody!

The documentation of stringr::str_view() specifies that it is possible to set string.html = TRUE as global option to avoid specifying the html = TRUE option - which generates a html output instead of the ANSI output standard since stringr 1.5.0 - in every call to str_view():

However, it simply does not work for me.

library(stringr)
options(stringr.html = TRUE)
c("a cat", "that dog", "a similar cat", "the penguin") |> 
str_view("cat")

image

Whereas specifying the option in a single call does work, with the html in the Viewer (and in markdown output, if working in a markdown document):

c("a cat", "that dog", "a similar cat", "the penguin") |> 
str_view("cat", html = TRUE)

image

I am working on posit Cloud (R version 4.3.1 and RStudio Pro 2023.09.1, Build 494.pro2), stringr 1.5.0.

Thanks if anybody has any idea of what I am doing wrong!

1 Like

Looking at the source code of str_view(), it doesn't seem to be checking that option at any point! Also searching through the repo, it seems the only place this option appears is in the documentation.

So I think this is a bug, and you could open an issue in the bug tracker, or even submit a PR.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.