txt_style: Wraps text in html or latex code for formatting

Description Usage Arguments Details Value See Also Examples

View source: R/txt_style.R

Description

txt_style adds appropriate html style wrappers to a string. Any number of options can be specified, as long as they match html CSS tags names.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
txt_style(x, type = "html", bold = FALSE, underline = FALSE,
  italics = FALSE, ...)

txt_color(x, color = "red")

txt_colour(x, colour = "red")

txt_size(x, size = "large")

txt_background(x, bg_color = "#ffff7f")

txt_font(x, font)

txt_bold(x)

txt_emph(x)

txt_ul(x)

txt_tocode(x)

Arguments

x

The string to be wrapped

type

The style of display, defaults to "html" (currently nothing else is supported, sorry)

bold

Should the text be bolded?

underline

Should the text be underlined?

italics

Should the text be italicized?

...

various display options: any html CSS style options, or one of font, size, color, background, style.

Details

txt_* are shortcuts for specific individual style options

Warning: These are simple direct wrappers for strings only. If you are working with demo_code objects, you should instead use the highlight functions.

Value

A string containing x with html wrappers.

See Also

highlight

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# General use
txt_style("I am highlighted!")
txt_style("I am blue and bold.", color = "blue", bold = TRUE)

# Shortcuts
txt_color("I am red.")
txt_color("I am blue.", color = "blue")

# Code styling wrapper
txt_tocode("I am code.")

kbodwin/demoR documentation built on Nov. 10, 2019, 11:30 p.m.