Giter Site home page Giter Site logo

josephbergevin / md-notebook Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jackos/md-notebook

0.0 0.0 0.0 1.85 MB

Execute code with any language in a notebook, source code is markdown, and generate code blocks with AI models

License: MIT License

JavaScript 1.36% TypeScript 98.64%

md-notebook's Introduction

md-notebook

Generate AI code blocks into a notebook, and execute them locally through many different languages.

Quick Start

  • Open or create a .md document
  • Add a cell
  • Select a language down 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 as you would expect

Important Note When you right-click on a file and select Reopen Editor With... you can configure default editor to be the standard Text Editor if you choose, and then reopen wth md-notebook only when you need it.

OpenAI Code Generation

  • Set up an OpenAI key here and change the setting: md-notebook: openai key
  • Default model is gpt-3.5-turbo, change the setting with md-notebook: openai model e.g. gpt-4
  • Select openai as your language in the bottom right
  • Ask it to show you how to do something in one of the supported lanuages
  • Run the code blocks it generates for you

Description

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

Rather than using complicated kernels, it simply spawns a process that runs your local toolchain for the language you're using, and returns the output. When you save the file it's standard markdown so you can use it for static site generators or upload to github.

Keybindings

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

Search Notes

Set up a folder with .md documents in mdl: base path and press alt+f to open a open search. This allows you to quickly search through your notes and execute code blocks. If you've ever used vimwiki this might bring back memories, but it's not reliant on a specific structure so you can set up your files for whatever static site generator you like.

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.

OpenAI

Generates code blocks which you can then run

Mojo

  • Import External Code
  • Language Server Support

Python

  • Import External Code
  • Language Server Support

Rust

  • Use external code:
  • Language Server Support

Rust-analyzer does work by hacking with line numbers and ranges on the server end, but it's not reliable enough to release.

Go

  • Import External Code
  • Language Server Support

Javascript

  • Import External Code
  • Language Server Support

Typescript

  • Import External Code
  • Language Server Support

Shell

  • nu
  • fish
  • bash

Inspiration

md-notebook's People

Contributors

jackos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.