Documentation
¶
Index ¶
- func AddColon(s string) string
- func AreChildrenSimilarLength(children []*workflowy.Item) bool
- func Capitalize(s string) string
- func ChildrenHaveGrandchildren(children []*workflowy.Item) bool
- func EndsWithPunctuation(s string) bool
- func EnsureCapitalized(s string) string
- func EnsurePunctuated(s string) string
- func FormatAsSentence(s string) string
- func FormatItemsAsMarkdown(items []*workflowy.Item) (string, error)
- func HasTag(s string, tag string) bool
- func HeaderPrefix(level int) string
- func IndentBullet(depth int) string
- func IsEmpty(s string) bool
- func IsEmptyBullet(item *workflowy.Item) bool
- func IsListIntroduction(name string) bool
- func IsListPattern(item *workflowy.Item) bool
- func JoinParagraphs(paragraphs []string) string
- func Punctuate(s string) string
- func StripTag(s string, tag string) string
- func Uppercase(s string) string
- func WordCount(s string) int
- type Config
- type DefaultFormatter
- func (f *DefaultFormatter) FormatNode(item *workflowy.Item, depth int) (string, error)
- func (f *DefaultFormatter) FormatTree(items []*workflowy.Item) (string, error)
- func (f *DefaultFormatter) GetLayoutMode(item *workflowy.Item, depth int) LayoutMode
- func (f *DefaultFormatter) ShouldExclude(item *workflowy.Item) bool
- type Formatter
- type LayoutMode
- type MarkdownConfig
- type MarkdownFormatter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AreChildrenSimilarLength ¶ added in v0.2.0
func Capitalize ¶
Capitalize returns the string with the first letter capitalized
func ChildrenHaveGrandchildren ¶ added in v0.2.0
func EndsWithPunctuation ¶ added in v0.2.0
func EnsureCapitalized ¶ added in v0.2.0
func EnsurePunctuated ¶ added in v0.2.0
func FormatAsSentence ¶ added in v0.2.0
func FormatItemsAsMarkdown ¶ added in v0.2.0
func HeaderPrefix ¶
HeaderPrefix returns the markdown header prefix (e.g., "# ", "## ")
func IndentBullet ¶
IndentBullet returns the appropriate markdown bullet indentation
func IsEmptyBullet ¶ added in v0.2.0
func IsListIntroduction ¶ added in v0.2.0
func IsListPattern ¶ added in v0.2.0
func JoinParagraphs ¶
JoinParagraphs joins multiple paragraph strings with a space
func Punctuate ¶
Punctuate adds a period at the end if the string doesn't already end with punctuation
Types ¶
type Config ¶
type Config struct {
Name string
// Header rules
H1Uppercase bool
H2Uppercase bool
H3Uppercase bool
H4Uppercase bool
H5Uppercase bool
H6Uppercase bool
// Paragraph rules
ParagraphCapitalize bool
ParagraphPunctuate bool
JoinBulletsAsParagraphs bool // Join consecutive bullets as paragraphs until empty bullet
// Punctuation rules
AddColonBeforeLists bool // Add colon at end of paragraph node with bullet children
// Tag recognition
ExcludeTag string // default: "#exclude"
H1Tag string // default: "#h1"
H2Tag string // default: "#h2"
H3Tag string // default: "#h3"
H4Tag string // default: "#h4"
H5Tag string // default: "#h5"
H6Tag string // default: "#h6"
// Fallback behavior when no layoutMode
UseDepthForHeaders bool // depth 1=h1, 2=h2, 3=h3, etc.
}
Config holds formatter configuration
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns the default formatter configuration
type DefaultFormatter ¶
type DefaultFormatter struct {
// contains filtered or unexported fields
}
DefaultFormatter implements the Formatter interface with standard rules
func NewDefaultFormatter ¶
func NewDefaultFormatter() *DefaultFormatter
NewDefaultFormatter creates a new formatter with default configuration
func NewFormatter ¶
func NewFormatter(config *Config) *DefaultFormatter
NewFormatter creates a new formatter with custom configuration
func (*DefaultFormatter) FormatNode ¶
FormatNode converts a single node and its children to markdown
func (*DefaultFormatter) FormatTree ¶
func (f *DefaultFormatter) FormatTree(items []*workflowy.Item) (string, error)
FormatTree converts entire tree to markdown
func (*DefaultFormatter) GetLayoutMode ¶
func (f *DefaultFormatter) GetLayoutMode(item *workflowy.Item, depth int) LayoutMode
GetLayoutMode determines effective layoutMode considering tags, depth, config
func (*DefaultFormatter) ShouldExclude ¶
func (f *DefaultFormatter) ShouldExclude(item *workflowy.Item) bool
ShouldExclude checks if node should be excluded from output
type Formatter ¶
type Formatter interface {
// FormatTree converts entire tree to markdown
FormatTree(items []*workflowy.Item) (string, error)
// FormatNode converts a single node to markdown
FormatNode(item *workflowy.Item, depth int) (string, error)
// ShouldExclude checks if node should be excluded from output
ShouldExclude(item *workflowy.Item) bool
// GetLayoutMode determines effective layoutMode considering tags, depth, config
GetLayoutMode(item *workflowy.Item, depth int) LayoutMode
}
Formatter defines the interface for converting Workflowy items to markdown
type LayoutMode ¶
type LayoutMode string
LayoutMode represents the type of content layout
const ( LayoutH1 LayoutMode = "h1" LayoutH2 LayoutMode = "h2" LayoutH3 LayoutMode = "h3" LayoutH4 LayoutMode = "h4" LayoutH5 LayoutMode = "h5" LayoutH6 LayoutMode = "h6" LayoutP LayoutMode = "p" LayoutBullets LayoutMode = "bullets" LayoutTodo LayoutMode = "todo" )
type MarkdownConfig ¶ added in v0.2.0
type MarkdownConfig struct {
ExcludeTag string
H1Tag string
H2Tag string
H3Tag string
PTag string
ListTag string
}
func DefaultMarkdownConfig ¶ added in v0.2.0
func DefaultMarkdownConfig() *MarkdownConfig
type MarkdownFormatter ¶ added in v0.2.0
type MarkdownFormatter struct {
// contains filtered or unexported fields
}
func NewMarkdownFormatter ¶ added in v0.2.0
func NewMarkdownFormatter() *MarkdownFormatter
func NewMarkdownFormatterWithConfig ¶ added in v0.2.0
func NewMarkdownFormatterWithConfig(config *MarkdownConfig) *MarkdownFormatter
func (*MarkdownFormatter) FormatTree ¶ added in v0.2.0
func (f *MarkdownFormatter) FormatTree(items []*workflowy.Item) (string, error)