as_svg {emphatic}R Documentation

Wrap a single emphatic object into an SVG for display

Description

This is mainly useful within a github README.md since github will not rendered html-styled text in colour, but will render it correctly if it is within a <svg> tags.

Usage

as_svg(
  x,
  width = 1200,
  height = 900,
  ...,
  font_size = NULL,
  style = list(),
  browsable = FALSE
)

Arguments

x

emphatic object

width, height

viewBox dimensions for SVG

...

other arguments passed to as.character.emphatic()

font_size

CSS font-size. Default: NULL means to not adjust font size. Otherwise, use valid CSS font-size specification e.g. "3em", "22px" etc.

style

html tag styling to apply to the <pre> wrapper for the returned HTML

browsable

Should the SVG be rendered to the RStudio Viewer pane when when printed (instead of console output)? Default: FALSE

Details

This is just a the results of as_html() wrapped in <svg> tags

Value

Character string containing SVG representation

Examples

hl_diff('hello', 'there') |>
  as_svg() |>
  cat()

[Package emphatic version 0.1.8 Index]