txt_style | R Documentation |
txt_style
adds appropriate html style wrappers to a string.
Any number of options can be specified, as long as they match html CSS
property names.
txt_style( x, type = "html", bold = FALSE, underline = FALSE, italics = FALSE, class = NULL, ... ) 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) txt_tag(x, before, after)
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? |
class |
CSS classes applied to the '<span>' tag wrapping the text. |
... |
various display options: any html CSS |
color |
Named or html hex color for font. |
colour |
Named or html hex color for font. |
size |
Font size |
bg_color |
Named or html hex color for text background. |
font |
A valid font family. |
before |
String giving specific html tags to insert before text. |
after |
String giving specific html tags to insert after text. |
txt_*
are shortcuts for specific individual style options
Warning: These are simple direct wrappers for strings only. If you are using
decorated
objects, you should instead use the
flair
functions.
A string containing x
with html wrappers.
flair
# 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.") # Can also use classes txt_style("I am danger", class = "text-danger")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.