Skip to content

pablofrommars/fsharp-notebook

Repository files navigation

fsharp-notebook

fsharp-notebook is a lightweight visualization tool to assist during data exploration and prototyping. In combination with ionide, VSCode becomes a very capable F# IDE for data science.

demo

Features

  • Register "rich output" printers to FSI
  • Render SVG plots, HTML fragments, Markdown and text cells
  • Export Notebooks to HTML

Command Palette

  • F# Notebook: Open Panel
  • F# Notebook: Export Panel
  • F# Notebook: Clear Panel

Settings

  • fsharpnotebook.styles: A list of CSS style sheets to use in notebooks.
  • fsharpnotebook.exportStyles: A list of CSS style sheets to use when exporting notebooks.

Configure Ionide-fsharp

Locate where fsharp-notebook extension is installed:

  • Windows %USERPROFILE%\.vscode\extensions\pablobelin.fsharp-notebook-*
  • macOS ~/.vscode/extensions/pablobelin.fsharp-notebook-*
  • Linux ~/.vscode/extensions/pablobelin.fsharp-notebook-*

And edit VSCode settings.json:

"FSharp.fsiExtraParameters": ["--load:path/to/extension/scripts/Notebook.fsx"]

Usage

Basic Example

open Notebook

let md = Markdown """
# Hello, Markdown!
"""

Custom printers

fsi.AddPrinter(fun (data : YourType) ->
    ... // Format to string
    |> SVG // or HTML or Markdown or Text
    |> printerNotebook
)