document

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package document writes Markdown slides into a portable HTML bundle.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteCascadingStyleSheet

func WriteCascadingStyleSheet(w io.Writer, css string) (err error)

func WriteEscapedHTML

func WriteEscapedHTML(w io.Writer, s string) error

code borrowed from `html` standard library package, simplified

func WriteEscapedJSON

func WriteEscapedJSON(w io.Writer, s []byte) (err error)

WriteEscapedJSON writes a string a JSON value with HTML escape codes applied. Double quotes, new lines, and carrier returns are escaped twice. This preserves JSON objects embedded into HTML element body.

func WriteFooter

func WriteFooter(w io.Writer) (err error)

func WriteHeader

func WriteHeader(w io.Writer, meta *Metadata) (err error)

func WriteJavascriptModuleES6

func WriteJavascriptModuleES6(w io.Writer, js string) (err error)

WriteJavascriptModuleES6 embeds an ES6 Javascript module into an io.Writer. ES6 modules cannot be loaded from local file system due to browser CORS restrictions. The `<script>` tag must be designated as a module.

Types

type DataWriter

type DataWriter struct {
	// contains filtered or unexported fields
}

func NewDataWriter

func NewDataWriter(w io.Writer, ID string) (*DataWriter, func() error, error)

func (*DataWriter) Add

func (d *DataWriter) Add(data []byte) error

func (*DataWriter) Close

func (d *DataWriter) Close() (err error)

func (*DataWriter) Open

func (d *DataWriter) Open(ID string) (err error)

type Metadata

type Metadata struct {
	ID          string
	Title       string
	Description string
	Author      string
	Year        int
	Created     time.Time
}

func NewMetadata

func NewMetadata(ctx parser.Context) (*Metadata, error)

func (*Metadata) ToHTML

func (m *Metadata) ToHTML(w io.Writer) (err error)

Directories

Path Synopsis
Package review presents a printable test constructed using a set of questions extracted from Markdown list items.
Package review presents a printable test constructed using a set of questions extracted from Markdown list items.
Package templates embeds HTML, Javascript, and CSS presentation components.
Package templates embeds HTML, Javascript, and CSS presentation components.

Jump to

Keyboard shortcuts

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