Documentation
¶
Overview ¶
Package transform converts source text into clipboard-ready representations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EmailParts ¶ added in v1.7.1
EmailParts makes the semantic email regions explicit so callers do not need to rely on language-specific greeting or sign-off detection.
type RichText ¶
RichText contains equivalent representations of a Markdown document. HTML is an email-safe fragment rather than a complete HTML document.
func EmailToRichText ¶ added in v1.7.1
func EmailToRichText(parts EmailParts) (*RichText, error)
EmailToRichText renders explicit email regions with normal email spacing. The salutation sits directly above the body; the sign-off is separated from the body and preserves its internal line breaks.
func MarkdownToRichText ¶
MarkdownToRichText converts CommonMark/GFM source to email-oriented HTML, concrete RTF formatting, and readable plain text.
type SlackFormatting ¶ added in v1.9.1
type SlackFormatting struct {
CodeBlocks int `json:"code_blocks"`
CodeLines int `json:"code_lines"`
InlineCodeSpans int `json:"inline_code_spans"`
Tables int `json:"tables"`
}
SlackFormatting describes the generated document, not the result of a paste.
type SlackMessage ¶ added in v1.9.0
type SlackMessage struct {
Delta string
PlainText string
Formatting SlackFormatting
Warnings []SlackWarning
}
SlackMessage holds the representations Slack's composer understands. Delta is Quill Delta JSON, the format Slack's own editor puts on the clipboard under the slack/texty MIME type; pasting it reconstructs native formatting rather than round-tripping through HTML. PlainText is the fallback every other target receives.
func MarkdownToSlack ¶ added in v1.9.0
func MarkdownToSlack(source string) (*SlackMessage, error)
MarkdownToSlack converts CommonMark/GFM source to a Quill Delta document plus readable plain text.
Quill's model splits formatting in two: inline attributes (bold, italic, strike, code, link) ride on the inserted text, while block attributes (header, list, blockquote, code-block, indent) attach to the newline that *terminates* the line they describe.
Slack's composer has no table, image, or horizontal-rule construct, so those are flattened to text that still carries their meaning rather than dropped.
type SlackWarning ¶ added in v1.9.1
SlackWarning identifies Markdown that may lose the author's intended layout.