Git Product home page Git Product logo

gobook's Introduction

Gobook: Go Notebook VS Code Extension

Getting Started

Create a markdown .md or .markdown document and open it

If extension hasn't activated, right click on file, select "Open With..." and click gobook

Create a cell, write some Go and press the play button

gobookExample

It will then start a task running gokernel

task

To see the generated source code, ctrl + click the temp file

ctrlClick

sourceCode

Right click the markdown file and reopen with text editor to see the markdown source code

repopen with

reopen2

github

Because the source code is standard markdown, it renders nicely on Github or blogging sites

github

Notes

  • If you are writing functions, put them in a separate cell, gokernel will put them outside the main function
  • If you terminate the gokernel task, the next time you execute a cell it will start again. This can be used to restart the kernel
  • On first execution it will check for gokernel and gopls updates with go get and install latest if required
  • The kernel will be installed to $GOPATH/bin/gokernel, delete it to force a reinstall
  • Code completion and full language server features are coming, but for now only the generated tmp/main.go works with gopls
  • Keyboard shortcuts are located in File > Preferences > Keyboard Shortcuts. Type in 'Notebook:' to see everything available.

Output Example

Check out gobook.dev which was created using only markdown files generated from this extension.

Kernel

The kernel is very simple source code here

Development Status

Working

  • Add an option to activate extension with .md or .gobook files
  • Activate extension as default when opening a .gobook file
  • Syntax highlighting
  • Save output of cells to file
  • Reload output when reopening file
  • Markdown formatting to represent code in and code out
  • Go kernel compiler to be 1 to 1 with normal Go
  • Imports no longer required, kernel imports automatically

In Development

  • Code completion / linting
  • Auto format cells
  • Variables explorer
  • Export to PDF

Future development

  • Add support to execute JS, TS and Python code cells with additional kernels
  • Shared state between all languages, i.e. initialize x in Python and use it in Go

gobook's People

Contributors

chrisdias avatar dependabot[bot] avatar jackos avatar microsoft-github-operations[bot] avatar microsoftopensource avatar roblourens avatar rzhao271 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.