highlight | R Documentation |
Text highlighter
highlight( text, dict, id = NULL, case_insensitive = TRUE, output = c("html", "tex", "ggplot", "plot"), return = FALSE ) hightlight_html(text, dict, id = NULL, case_insensitive = TRUE, return = FALSE) hightlight_tex(text, dict, id = NULL, case_insensitive = TRUE, return = FALSE) hightlight_plot(text, dict, id = NULL, case_insensitive = TRUE, return = FALSE)
text |
A text to be printed with highlighted words. |
dict |
A data.frame with columns "word" and "colour". |
id |
A vector of ids which are displayed as headlines. |
case_insensitive |
Should search for feature be case insensitive? |
output |
Choose output format. |
return |
Should the code be returned as an object. |
text <- c("This is a good test with some bad words", "bad is red and good is green") df <- data.frame( feature = c("good", "bad"), bg_colour = c("green", "red"), txt_colour = c("grey", "blue"), bold = TRUE, italic = TRUE, strike_out = TRUE, stringsAsFactors = FALSE ) mydict <- as_dict(df) highlight(text, mydict)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.