highlight_style: Generate an HTML/CSS Style

Description Usage Arguments Value Examples

Description

Generate an HTML/CSS style syntax for highlight marker tags. Useful in knitr/rmarkdown style documents.

Usage

1
highlight_style(marker_color)

Arguments

marker_color

A named list or vector of colors. The colors will be used for highlighting and the names will correspond to the class name of the marker tag.

Value

Returns a vector with an HTML/CSS style template.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
marks <- c(pos = "lightgreen", neg = "pink", neutral = "yellow")
highlight_style(marks)

## A .Rmd Example
## 1. Read the lines below into `content`
## 2. Paste together and `cat` a file out
## 3. `render` via rmarkdown package
## 4. Open the html document
## Not run: 
content <- readLines(n=26)
---
title: "Test"
date: "`r format(Sys.time(), '%d %B, %Y')`"
output:
  html_document:
    toc: true
    theme: journal
    number_sections: true
---

```{r, echo=FALSE}
pacman::p_load(hilight)
x <-"I like good cheeses but she hated Bad cheese"
stems <- c("cheese", "like", "good", "bad")
marks_class <- c("neutral", "pos", "pos", "neg")
marks <- c(pos = "lightgreen", neg = "pink", neutral = "yellow")
body <- mark_word_stems(x, stems, marks_class)
```

```{r, echo=FALSE, results='asis'}
highlight_style(marks)
```

```{r, echo=FALSE, results='asis'}
cat(body)
```

cat(paste(content, collapse="\n"), "\n", file="test.Rmd")
rmarkdown::render("test.Rmd")
browseURL("test.html")

## End(Not run)

trinker/hilight documentation built on May 31, 2019, 8:51 p.m.