docs

package
v3.14.2 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BASHLANG = "bash"
	// OUTPUTLANG is the language to give to output code blocks.
	// We want to potentially distinguish output from code blocks because output blocks are nested inside blocks
	// in notebooks. Therefore if we want to be able to convert a markdown document into a document with blocks
	// then having a unique language for output blocks helps us identify them and properly reencode them.
	OUTPUTLANG = "output"

	// StatefulRunmeOutputItemsMimeType is the mime type for output items in runme. This will be a JSON object.
	// See:
	//    https://github.com/stateful/vscode-runme/blob/3e36b16e3c41ad0fa38f0197f1713135e5edb27b/src/constants.ts#L6
	//    https://github.com/jlewi/foyle/issues/286
	StatefulRunmeOutputItemsMimeType = "stateful.runme/output-items"
	StatefulRunmeTerminalMimeType    = "stateful.runme/terminal"
	VSCodeNotebookStdOutMimeType     = "application/vnd.code.notebook.stdout"
)

Variables

This section is empty.

Functions

func BlockToMarkdown

func BlockToMarkdown(block *agent.Block, maxLength int) string

BlockToMarkdown converts a block to markdown maxLength is a maximum length for the generated markdown. This is a soft limit and may be exceeded slightly because we don't account for some characters like the outputLength and the truncation message A value <=0 means no limit.

func MarkdownToBlocks

func MarkdownToBlocks(mdText string) ([]*agent.Block, error)

MarkdownToBlocks converts a markdown string into a sequence of blocks. This function relies on RunMe's Markdown->Cells conversion; underneath the hood that uses goldmark to walk the AST. RunMe's deserialization function doesn't have any notion of output in markdown. However, in Foyle outputs are rendered to code blocks of language "output". So we need to do some post processing to convert the outputs into output items

Types

This section is empty.

Jump to

Keyboard shortcuts

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