highlight_template: Generate an HTML Highlight Template

Description Usage Arguments Value Examples

Description

Generate an HTML syntax with css for highlight marker tags that takes a body insert and can then be used to generate an HTML output with text highlighting.

Usage

1
highlight_template(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 read template.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
marks <- c(pos = "lightgreen", neg = "pink", neutral = "yellow")
temp <- highlight_template(marks)
body <- paste0("I like <mark class=\"pos\">good</mark>",
    " <mark class=\"neutral\">fish</mark>",
    ", but <mark class=\"neg\">bad</mark> <mark class=\"neutral\">fish</mark>",
    " is <mark class=\"neg\">gross</mark>.")

template2html(insert_body(highlight_template(marks), body), file="")

## Not run: 
## To an external file
template2html(insert_body(highlight_template(marks), body))
open_html()

## End(Not run)

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