NotesEnabled specifies whether presenter notes should be displayed in the present user interface.
var NotesEnabled = false
PlayEnabled specifies whether runnable playground snippets should be displayed in the present user interface.
var PlayEnabled = false
func Register(name string, parser ParseFunc)
Register binds the named action, which does not begin with a period, to the specified parser to be invoked when the name, with a period, appears in the present input text.
func Style(s string) template.HTML
Style returns s with HTML entities escaped and font indicators turned into HTML font tags.
▹ Example
func Template() *template.Template
Template returns an empty template with the action functions in its FuncMap.
Author represents the person who wrote and/or is presenting the document.
type Author struct { Elem []Elem }
func (p *Author) TextElem() (elems []Elem)
TextElem returns the first text elements of the author details. This is used to display the author' name, job title, and company without the contact details.
type Caption struct { Text string }
func (c Caption) TemplateName() string
type Code struct { Text template.HTML Play bool // runnable code Edit bool // editable code FileName string // file name Ext string // file extension Raw []byte // content of the file }
func (c Code) TemplateName() string
A Context specifies the supporting context for parsing a presentation.
type Context struct { // ReadFile reads the file named by filename and returns the contents. ReadFile func(filename string) ([]byte, error) }
func (ctx *Context) Parse(r io.Reader, name string, mode ParseMode) (*Doc, error)
Parse parses a document from r.
Doc represents an entire document.
type Doc struct { Title string Subtitle string Time time.Time Authors []Author TitleNotes []string Sections []Section Tags []string }
func Parse(r io.Reader, name string, mode ParseMode) (*Doc, error)
Parse parses a document from r. Parse reads assets used by the presentation from the file system using ioutil.ReadFile.
func (d *Doc) Render(w io.Writer, t *template.Template) error
Render renders the doc to the given writer using the provided template.
Elem defines the interface for a present element. That is, something that can provide the name of the template used to render the element.
type Elem interface { TemplateName() string }
type HTML struct { template.HTML }
func (s HTML) TemplateName() string
type Iframe struct { URL string Width int Height int }
func (i Iframe) TemplateName() string
type Image struct { URL string Width int Height int }
func (i Image) TemplateName() string
Lines is a helper for parsing line-based input.
type Lines struct {
// contains filtered or unexported fields
}
type Link struct { URL *url.URL Label string }
func (l Link) TemplateName() string
List represents a bulleted list.
type List struct { Bullet []string }
func (l List) TemplateName() string
type ParseFunc func(ctx *Context, fileName string, lineNumber int, inputLine string) (Elem, error)
ParseMode represents flags for the Parse function.
type ParseMode int
const ( // If set, parse only the title and subtitle. TitlesOnly ParseMode = 1 )
Section represents a section of a document (such as a presentation slide) comprising a title and a list of elements.
type Section struct { Number []int Title string Elem []Elem Notes []string Classes []string Styles []string }
func (s Section) FormattedNumber() string
FormattedNumber returns a string containing the concatenation of the numbers identifying a Section.
func (s Section) HTMLAttributes() template.HTMLAttr
HTMLAttributes for the section
func (s Section) Level() int
Level returns the level of the given section. The document title is level 1, main section 2, etc.
func (s *Section) Render(w io.Writer, t *template.Template) error
Render renders the section to the given writer using the provided template.
func (s Section) Sections() (sections []Section)
Sections contained within the section.
func (s Section) TemplateName() string
Text represents an optionally preformatted paragraph.
type Text struct { Lines []string Pre bool }
func (t Text) TemplateName() string
type Video struct { URL string SourceType string Width int Height int }
func (v Video) TemplateName() string