/codebook

Visual Studio Code Extension to run Markdown documents as interactive notebooks

Primary LanguageTypeScriptMIT LicenseMIT

Codebook

Quick Start

  • Open or create a .md document
  • Add a cell
  • Chose your language in the bottom right
  • Run the code and save the document
  • The output is now saved to standard Markdown
  • Upload to Github to see outputs rendered properly

Description

Straight nodejs stateless implementation for notebooks with no npm dependencies or external binaries, works with compiled languages.

Rather than using any complicated kernels, it simply spawns a process that runs your local toolchain for the language you're using and returns outputs for all previous cells using the current cell's language.

Keybindings

You can change keybindings in File > Preferences > Keybindings > search for "codebook". Or you can run them via command palette typing in "codebook"

Search Notes

Press alt+f to open a welcome document and get started, alt+f will also open search in the base path (defaults to ~/codebook) which can be changed in settings: File > Preferences > Settings > search for "codebook". Any notes you keep in here will be searchable from any repository by pressing alt+f.

Open Generated Code

Press alt+o to open up the source code being used to generate outputs, which will allow you to check your code with a language server if it's not supported in the cells yet.

Language Support

It's very simple to add your own language, look inside src/languages/rust.ts for an example, then add your language to the switch statement in src/kernel.ts. Please open a pull request if you add a language, it's a lot easier than you might expect and it will be appreciated.

Rust

  • Latency 0.1ms
  • Import External Code

Go

  • Latency 0.1ms
  • Import External Code

Javascript

  • Latency 0.3ms
  • Language server

Typescript

  • Latency 0.7ms
  • Language server

Inspiration