editor

package
v3.3.2 Latest Latest
Warning

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

Go to latest
Published: May 28, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InternalAttributePrefix = "runme.dev"
	PrivateAttributePrefix  = "_"
)
View Source
const (
	FrontmatterKey = "frontmatter"
	DocumentID     = "id"
)

Variables

This section is empty.

Functions

func DumpAttributes

func DumpAttributes(n ast.Node, source []byte) map[string]interface{}

func DumpToMap

func DumpToMap(node ast.Node, source []byte, root string) *map[string]interface{}

func PrefixAttributeName

func PrefixAttributeName(prefix, name string) string

func Serialize

func Serialize(notebook *Notebook, outputMetadata *document.RunmeMetadata) ([]byte, error)

Types

type Cell

type Cell struct {
	Kind             CellKind              `json:"kind"`
	Value            string                `json:"value"`
	LanguageID       string                `json:"languageId"`
	Metadata         map[string]string     `json:"metadata,omitempty"`
	Outputs          []*CellOutput         `json:"outputs,omitempty"`
	TextRange        *TextRange            `json:"textRange,omitempty"`
	ExecutionSummary *CellExecutionSummary `json:"executionSummary,omitempty"`
}

Cell resembles NotebookCellData from VS Code. https://github.com/microsoft/vscode/blob/085c409898bbc89c83409f6a394e73130b932add/src/vscode-dts/vscode.d.ts#L13715

type CellExecutionSummary

type CellExecutionSummary struct {
	ExecutionOrder uint32                  `json:"executionSummary"`
	Success        bool                    `json:"success"`
	Timing         *ExecutionSummaryTiming `json:"timing,omitempty"`
}

type CellKind

type CellKind int
const (
	MarkupKind CellKind = iota + 1
	CodeKind
)

type CellOutput

type CellOutput struct {
	Items       []*CellOutputItem      `json:"items"`
	Metadata    map[string]string      `json:"metadata,omitempty"`
	ProcessInfo *CellOutputProcessInfo `json:"processInfo"`
}

type CellOutputItem

type CellOutputItem struct {
	Value string `json:"value"`
	Data  string `json:"data"`
	Type  string `json:"type"`
	Mime  string `json:"mime"`
}

type CellOutputProcessInfo

type CellOutputProcessInfo struct {
	ExitReason *ProcessInfoExitReason `json:"exitReason"`
	Pid        int64                  `json:"pid"`
}

type ExecutionSummaryTiming

type ExecutionSummaryTiming struct {
	StartTime int64 `json:"startTime"`
	EndTime   int64 `json:"endTime"`
}

type Notebook

type Notebook struct {
	Cells       []*Cell               `json:"cells"`
	Metadata    map[string]string     `json:"metadata,omitempty"`
	Frontmatter *document.Frontmatter `json:"frontmatter,omitempty"`
}

Notebook resembles NotebookData form VS Code. https://github.com/microsoft/vscode/blob/085c409898bbc89c83409f6a394e73130b932add/src/vscode-dts/vscode.d.ts#L13767

func Deserialize

func Deserialize(data []byte, identityResolver *identity.IdentityResolver) (*Notebook, error)

func (*Notebook) ForceLifecycleIdentities

func (n *Notebook) ForceLifecycleIdentities()

This mimics what otherwise would happen in the extension

type ProcessInfoExitReason

type ProcessInfoExitReason struct {
	Type string `json:"type"`
	Code uint32 `json:"code"`
}

type TextRange

type TextRange struct {
	Start int `json:"start"`
	End   int `json:"end"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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