@@ -20,6 +20,8 @@ type FsiEmbedKind =
2020 | ConsoleOutput
2121 /// The 'it' value
2222 | ItValue
23+ /// The 'it' value as raw text
24+ | ItRaw
2325 /// A specific value
2426 | Value
2527
@@ -376,6 +378,22 @@ module __FsiSettings =
376378 let outputText = defaultArg result.FsiMergedOutput " No output has been produced."
377379 let output = outputText.Trim()
378380 [ OutputBlock ( output, " text/plain" , Some executionCount) ]
381+ | { ItValue = Some ( obj, ty) }, FsiEmbedKind.ItRaw ->
382+ match valueTransformations |> Seq.pick ( fun f -> lock lockObj ( fun () -> f ( obj, ty, executionCount))) with
383+ | [] ->
384+ [ OutputBlock( " No value returned by any evaluator" , " text/plain" , Some executionCount) ]
385+ | blocks ->
386+ blocks
387+ |> List.map ( function
388+ | OutputBlock( output,_, Some executionCount) ->
389+ let output =
390+ if ty.FullName = ( typeof< string>) .FullName then
391+ let l = output.Length
392+ output.Substring( 1 , l-2 )
393+ else
394+ output
395+ OutputBlock( output, " text/html" , Some executionCount)
396+ | _ -> OutputBlock( " Value could not be returned raw" , " text/plain" , Some executionCount))
379397 | { ItValue = Some ( obj, ty) }, FsiEmbedKind.ItValue
380398 | { Result = Some ( obj, ty) }, FsiEmbedKind.Value ->
381399 match valueTransformations |> Seq.pick ( fun f -> lock lockObj ( fun () -> f ( obj, ty, executionCount))) with
0 commit comments