common

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PlainText    = "text/plain"
	MarkdownText = "text/markdown"
	Stdout       = "application/vnd.jupyter.stdout" // Custom mime-type for stream output to stdout.
	Stderr       = "application/vnd.jupyter.stderr" // Custom mime-type for stream output to stderr.
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Markdown added in v0.3.0

type Markdown struct {
	Source MultilineString `json:"source"`
}

Markdown defines the schema for a "markdown" cell.

func (*Markdown) MimeType added in v0.3.0

func (md *Markdown) MimeType() string

func (*Markdown) Text added in v0.3.0

func (md *Markdown) Text() []byte

func (*Markdown) Type added in v0.3.0

func (md *Markdown) Type() schema.CellType

type MultilineString

type MultilineString []string

MultilineString stores multi-line text as strings or string arrays in the raw JSON. TODO(optimization): check if we can scan into [][]byte directly

func (MultilineString) Text

func (s MultilineString) Text() (txt []byte)

Text concatenates all lines in a multiline string into a single byte slice.

func (*MultilineString) UnmarshalJSON

func (s *MultilineString) UnmarshalJSON(data []byte) error

type Notebook

type Notebook struct {
	VersionMajor int             `json:"nbformat"`
	VersionMinor int             `json:"nbformat_minor"`
	Metadata     json.RawMessage `json:"metadata"` // TODO: omitempty
}

func (*Notebook) Version

func (n *Notebook) Version() schema.Version

type Raw added in v0.3.0

type Raw struct {
	Source   MultilineString `json:"source"`
	Metadata RawCellMetadata `json:"metadata"`
}

Raw defines the schema for a "raw" cell.

func (*Raw) MimeType added in v0.3.0

func (raw *Raw) MimeType() string

func (*Raw) Text added in v0.3.0

func (raw *Raw) Text() []byte

func (*Raw) Type added in v0.3.0

func (raw *Raw) Type() schema.CellType

type RawCellMetadata added in v0.3.0

type RawCellMetadata struct {
	Format      *string `json:"format"`
	RawMimeType *string `json:"raw_mimetype"`
}

RawCellMetadata may specify a target conversion format.

func (*RawCellMetadata) MimeType added in v0.3.0

func (raw *RawCellMetadata) MimeType() string

MimeType returns a more specific mime-type if one is provided and "text/plain" otherwise.

Jump to

Keyboard shortcuts

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