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.
as_svg(
x,
width = 1200,
height = 900,
...,
font_size = NULL,
style = list(),
browsable = FALSE
)
emphatic object
viewBox dimensions for SVG
other arguments passed to as.character.emphatic()
CSS font-size. Default: NULL means to not adjust font size.
Otherwise, use valid CSS font-size
specification e.g.
"3em", "22px" etc.
html tag styling to apply to the <pre>
wrapper for the
returned HTML
Should the SVG be rendered to the RStudio Viewer pane when when printed (instead of console output)? Default: FALSE
character string containing an SVG snippet.
Character string containing SVG representation
This is just a the results of as_html()
wrapped in <svg>
tags
hl_diff('hello', 'there') |>
as_svg() |>
cat()
#> <svg fill="none" viewBox="0 0 1200 900" width="1200" height="900" xmlns="http://www.w3.org/2000/svg"><g visibility="visible">
#> <foreignObject width="100%" height="100%">
#> <div xmlns="http://www.w3.org/1999/xhtml">
#> <pre style=''>
#> <span><span>[1] "</span></span><span style='color:#000000;'><span style='background-color:#9aff9a;'> </span></span><span><span>he</span></span><span style='color:#000000;'><span style='background-color:#97ffff;'>ll</span></span><span style='color:#000000;'><span style='background-color:#ff7f50;'>o</span></span><span><span>"</span></span><br/><span><span>[1] "</span></span><span style='color:#000000;'><span style='background-color:#9aff9a;'>t</span></span><span><span>he</span></span><span style='color:#000000;'><span style='background-color:#97ffff;'>re</span></span><span style='color:#000000;'><span style='background-color:#ff7f50;'> </span></span><span><span>"</span></span>
#> </pre>
#> </div>
#> </foreignObject>
#>
#> </g></svg>