8000 Merge pull request #36 from npmurphy/add_svg_type · fsprojects/IfSharp@d0cd13e · GitHub
[go: up one dir, main page]

Skip to content

Commit d0cd13e

Browse files
committed
Merge pull request #36 from npmurphy/add_svg_type
add SVG display type
2 parents a83750c + fba3f4d commit d0cd13e

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/IfSharp.Kernel/Printers.fs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@ module Printers =
7777
{ ContentType = "text/html"; Data = sb.ToString() }
7878
)
7979

80+
// add svg printer
81+
addDisplayPrinter(fun (x:SvgOutput) ->
82+
{ ContentType = "image/svg+xml"; Data = x.Svg }
83+
)
84+
8085
// add html printer
8186
addDisplayPrinter(fun (x:HtmlOutput) ->
8287
{ ContentType = "text/html"; Data = x.Html }

src/IfSharp.Kernel/Util.fs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ type HtmlOutput =
3232
Html: string;
3333
}
3434

35+
type SvgOutput =
36+
{
37+
Svg: string;
38+
}
39+
3540
type GenericChartWithSize =
3641
{
3742
Chart: ChartTypes.GenericChart;
@@ -97,6 +102,9 @@ type Util =
97102
static member Latex (str) =
98103
{ Latex = str}
99104

105+
static member Svg (str) =
106+
{ Svg = str}
107+
100108
/// Wraps a LatexOutput around a string in order to send to the UI.
101109
static member Math (str) =
102110
{ Latex = "$$" + str + "$$" }

0 commit comments

Comments
 (0)
0