editor

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

func DumpAttributes added in v1.8.0

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

func DumpToMap added in v1.8.0

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

func PrefixAttributeName added in v1.2.3

func PrefixAttributeName(prefix, name string) string

func Serialize

func Serialize(notebook *Notebook) ([]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"`
	TextRange  *TextRange        `json:"textRange,omitempty"`
}

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

func (*Cell) EnsureID added in v1.8.0

func (c *Cell) EnsureID()

type CellKind

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

type Notebook

type Notebook struct {
	Cells    []*Cell           `json:"cells"`
	Metadata map[string]string `json:"metadata,omitempty"`
	// contains filtered or unexported fields
}

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, requireIdentity bool) (*Notebook, error)

func (*Notebook) GetContentOffset added in v1.2.0

func (n *Notebook) GetContentOffset() int

func (*Notebook) ParsedFrontmatter added in v1.2.1

func (n *Notebook) ParsedFrontmatter() (document.Frontmatter, *document.FrontmatterParseInfo)

type TextRange added in v1.0.2

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