Categorygithub.com/igorhub/devcard
modulepackage
0.11.0
Repository: https://github.com/igorhub/devcard.git
Documentation: pkg.go.dev

# README

Devcards

Devcards provides interactive visual environment for Go, in a way that's similar to REPL and computational notebooks such as Jupyter.

How it works

A devcard is a playground for visualizations and quick experiments. You write its code with our own editor in you own codebase, and the devcards web app turns it into a web page that's shown in your browser. The app watches your project's source files and re-renders the page on each save.

See this short video for a quick demonstration.

Getting started

Perhaps the easiest place to start is to the devcard examples repo.

If you went through the examples already (or have no patience for toy code) follow the following instructions.

Install the devcards web app:

go install github.com/igorhub/devcard/cmd/devcards@latest

Add devcard dependency to your Go modules (I recommend making a separate branch for it):

go get github.com/igorhub/devcard

Start devcards from your project's directory (alternatively, add your project to the config file):

cd /path/to/your/project
devcards

Write your first devcard:

package yourpackage

import "github.com/igorhub/devcard"

func DevcardFoobar(dc *devcard.Devcard) {
    dc.SetTitle("Untitled")

    dc.Md("This is a new devcard...")
}

Documentation

For introduction into devcards, see devcard examples pages.

For API reference, see https://godocs.io/github.com/igorhub/devcard.

Troubleshooting

Devcards is a young project. I've done reasonable job ironing out the bugs, but I expect some to still lurk beneath the surface. In most cases simply refreshing the page will fix everything. Still, please let me know about the errors you encounter. This will make the project better. I appreciate your help.

Acknowledgements

  • Devcards owes its name and primary idea to Bruce Hauman's devcards, although it's more bare-bones and limited in scope.

  • Devcards' builtin CSS style is based upon the excellent new.css.

  • Ace of Spades icon is designed by DesignContest / CC BY.

# Packages

No description provided by the author
No description provided by the author

# Functions

Current returns a global pointer to the devcard that's currently being produced.
Debug facilitates debugging.
No description provided by the author
NewAnnotatedValueCell creates [AnnotatedValueCell].
NewErrorCell creates [ErrorCell].
NewHTMLCell creates [HTMLCell].
NewImageCell creates [ImageCell].
NewJumpCell creates [JumpCell].
NewMarkdownCell creates [MarkdownCell].
NewMonospaceCell creates [MonospaceCell].
NewSourceCell creates [SourceCell].
NewValueCell creates [ValueCell].
UnmarshalCell unmarshalls JSON data into a Cell instance.
WithHighlighting is an option for [Devcard.Mono].

# Constants

Message types are used for communication with devcards server via TCP connection.
Message types are used for communication with devcards server via TCP connection.
Message types are used for communication with devcards server via TCP connection.

# Variables

Default JumpCell delay, in milliseconds.

# Structs

AnnotatedImage as an image with its description.
AnnotatedValueCell contains pretty-printed Go value and its description/annotation.
AnnotatedValueCell is a cell with pretty-printed Go values that have comments attached to them.
CustomCell provides a base for user-defined cells.
Devcard struct represents the devcard shown to the user.
DevcardInfo describes devcard's metadata.
ErrorCell is a cell for error reporting.
HTMLCell is a cell with markdown-formatted text.
ImageCell is a cell with annotated images.
JumpCell is a cell to which we scroll when it's rendered.
MarkdownCell is a cell with markdown-formatted text.
MonospaceCell is a cell that's supposed to be rendered as monospace, such as block of code.
SourceCell is a cell with source code of a function.
ValueCell is a cell with pretty-printed Go values.

# Interfaces

Cell is a basic building block of a devcard.

# Type aliases

DevcardProducer is a function that fills an empty devcard with content.