Render pic source to an SVG string
Errors
Compile errors are raised as a classed rpic_error condition whose
info field holds the structured diagnostic (message, line, col,
end_col, file, kind, found, expected, hint; absent values are
NA, and file names a copy include — NA means your own input).
Positions are relative to your own source, even with circuits = TRUE:
Examples
rpic_svg('box "hi"; arrow; circle "x"')
#> [1] "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"171.2\" height=\"51.2\" viewBox=\"0 0 171.2 51.2\" font-family=\"sans-serif\" font-size=\"14.666667\" fill=\"none\">\n<g id=\"s0\">\n<rect x=\"1.066667\" y=\"0.533333\" width=\"72\" height=\"48\" fill=\"none\" stroke=\"black\" stroke-width=\"1.066667\"/>\n<text font-size=\"11pt\" stroke-width=\"0.2pt\" fill=\"black\" x=\"37.066667\" y=\"29.373333\" text-anchor=\"middle\">hi</text>\n</g>\n<g id=\"s1\">\n<line x1=\"73.066667\" y1=\"24.533333\" x2=\"118.867677\" y2=\"24.533333\" stroke=\"black\" stroke-width=\"1.066667\"/>\n<polygon stroke-width=\"0\" points=\"111.466667,22.133333 121.066667,24.533333 111.466667,26.933333\" fill=\"black\"/>\n</g>\n<g id=\"s2\">\n<circle cx=\"145.066667\" cy=\"24.533333\" r=\"24\" fill=\"none\" stroke=\"black\" stroke-width=\"1.066667\"/>\n<text font-size=\"11pt\" stroke-width=\"0.2pt\" fill=\"black\" x=\"145.066667\" y=\"29.373333\" text-anchor=\"middle\">x</text>\n</g>\n</svg>\n"
tryCatch(rpic_svg("bxo"), rpic_error = function(e) e$info$line)
#> [1] 1