gd

command module
v0.0.0-...-80d7cf0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 10, 2021 License: BSD-3-Clause Imports: 18 Imported by: 0

README

gd

The gd program runs a single file Go program and renders it and its output as Markdown. It also allows inclusion of plain prose via C-style comments with a {md} prefix.

Example output

This is the output from running the Go Hello World program with gd.

```
package main

import "fmt"

func main() {
	fmt.Println("Hello, world!")
```
> ```stdout
> Hello, world!
> ```
```
}
```

Which will render as this:

package main

import "fmt"

func main() {
	fmt.Println("Hello, world!")
Hello, world!
}

gd can also include graphic output in the Markdown document.

Limitations

Panic calls cannot be reflected in output since a panic takes control away from the gd-running program. To be able to capture output and associate it with source code lines, gd rewrites imports of "fmt" and "log" to "github.com/kortschak/gd/fmt" and "github.com/kortschak/gd/log". Behaviour of "fmt" is well replicated, but gd replaces log.Panic* calls with a simulation of a panic that outputs a stack trace and then exits. This means that stack unwinding is not performed and a log.Panic* call cannot be recovered. The panic built-in behaves as normal, but the panic output cannot be retrieved by gd.

Documentation

Overview

gd renders a single Go source file and it's text and graphic output into a single Markdown file.

Directories

Path Synopsis
examples
svg
Package fmt implements formatted I/O to a JSON stream analogous the the standard library fmt package.
Package fmt implements formatted I/O to a JSON stream analogous the the standard library fmt package.
internal
enc
Package enc provides an JSON event stream protocol.
Package enc provides an JSON event stream protocol.
Package log implements a work-alike to the standard library's log package that writes logging on os.Stdout and os.Stderr to a JSON even stream written to os.Stdout.
Package log implements a work-alike to the standard library's log package that writes logging on os.Stdout and os.Stderr to a JSON even stream written to os.Stdout.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL