docs

package
v3.15.1 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 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 cells.
	// We want to potentially distinguish output from code cells because output cells are nested inside cells
	// in notebooks. Therefore if we want to be able to convert a markdown document into a document with cells
	// then having a unique language for output cells 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"
	VSCodeNotebookStdErrMimeType     = "application/vnd.code.notebook.stderr"
)

Variables

This section is empty.

Functions

func CellToMarkdown added in v3.15.0

func CellToMarkdown(cell *parserv1.Cell, maxLength int) string

CellToMarkdown converts a cell 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 MarkdownToCells added in v3.15.0

func MarkdownToCells(mdText string) ([]*parserv1.Cell, error)

MarkdownToCells converts a markdown string into a sequence of cells. 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 cells 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