Documentation ¶
Overview ¶
Package stitch defines the core data types for a stitch document.
Summary is the full summary file, comprised of one or more [Section]s, each of which in turn has one or more [Item]s.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EmbedItem ¶ added in v0.8.0
type EmbedItem struct { // Title of the link. // This is the text inside the "[..]" section. Text string // Target is the destination of this item. // This is the text inside the "(..)" section of the link. // It's /-separated, even on Windows. Target string // Depth is the depth of this item in the table of contents. Depth int // AST holds the original node. AST ast.Node }
EmbedItem is a reference to another summary file intended to be nested in the table of contents.
![Foo](foo.md)
type LinkItem ¶
type LinkItem struct { // Text of the item. // This is the text inside the "[..]" section of the link. Text string // Target is the destination of this item. // This is the text inside the "(..)" section of the link. // It's /-separated, even on Windows. Target string // Depth is the depth of the item in the table of contents. // Depth starts at zero for top-level items. Depth int // AST holds the original link node. AST *ast.Link }
LinkItem is a single link item in a table of contents.
[Foo](foo.md)
type Section ¶
type Section struct { Title *SectionTitle // Items lists the items in the section // and their nested items. Items tree.List[Item] // AST holds the original list // from which this Section was built. AST *ast.List }
Section is a single section of a summary document. It's comprised of an optional title and a tree of items.
type SectionTitle ¶
type SectionTitle struct { // Text of the title. Text string // Level of the title. Level int // AST node that this title was built from. AST *ast.Heading }
SectionTitle holds information about a section title.
type Summary ¶
type Summary struct { // Sections is a list of sections in the summary. Sections []*Section }
Summary is the complete summary document. It's comprised of one or more sections.
func ParseSummary ¶
ParseSummary parses a summary from a Markdown document. The summary is expected in a very specific format:
- it's comprised of one or more sections
- each section has an optional title header and a list of items
- each item is either a link to a Markdown document or a plain text title
- items may be nested to indicate a hierarchy
For example:
# User Guide - [Getting Started](getting-started.md) - [Installation](installation.md) - Options - [foo](foo.md) - [bar](bar.md) - [Reference](reference.md) # Appendix - [FAQ](faq.md)
Anything else will result in an error.
type TextItem ¶
type TextItem struct { // Text of the item. Text string // Depth is the depth of the item in the table of contents. // Depth starts at zero for top-level items. Depth int // AST holds the original text node. AST *ast.Text }
TextItem is a single text entry in the table of contents.
Foo