Documentation
¶
Overview ¶
Package markdown converts standard markdown to platform-specific formats.
Index ¶
- func ExtractMention(body string, mentions []TeamsMention, userID string) bool
- func MarkdownToTeamsHTML(md string) string
- func SplitMessage(text string, limit int) []string
- func SplitMessageTeams(text string) []string
- func SplitSummaryAndReport(text string) (summary, report string)
- func StripCompressionMarkers(s string) string
- func TeamsHTMLToPlain(s string) string
- func ToSlackMrkdwn(text string) string
- func ToTelegramHTML(text string) string
- type TeamsMention
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractMention ¶
func ExtractMention(body string, mentions []TeamsMention, userID string) bool
ExtractMention reports whether userID is @-mentioned in the message body. It checks the parsed mentions[] array first (authoritative), then falls back to scanning the body for <at id="N"> tags whose corresponding mentions entry resolves to userID.
func MarkdownToTeamsHTML ¶
MarkdownToTeamsHTML converts standard markdown to the HTML subset Teams renders in chatMessage bodies when contentType == "html".
Supported: headings, bold, italic, inline code, fenced code, links, ordered/unordered lists, blockquotes. Unsupported features (e.g. tables, images) degrade to escaped plain text rather than raw HTML so the output is always safe to drop into body.content.
func SplitMessage ¶
SplitMessage splits a long message into chunks that fit within limit. It splits at paragraph boundaries first, then newlines, then hard-splits.
func SplitMessageTeams ¶
SplitMessageTeams splits text into chunks that each fit within the Teams body limit. Prefers paragraph boundaries, then newlines, then hard splits. Mirrors the existing SplitMessage helper but uses the Teams threshold.
func SplitSummaryAndReport ¶
SplitSummaryAndReport splits a long response into a summary and full report. The summary is the first paragraph (up to the first double newline), capped at 600 characters, with a note that the full report is attached as a file. If no paragraph boundary is found, falls back to a 500-char truncation at a sentence boundary.
func StripCompressionMarkers ¶ added in v0.18.1
StripCompressionMarkers removes any ctxzip markers that leaked into channel-bound text or file content. These are internal artifacts of context compression; a user must never see them. The model is expected to expand offloaded content it needs before answering, so a marker reaching a channel is a leak — drop it rather than surface a dangling pointer.
func TeamsHTMLToPlain ¶
TeamsHTMLToPlain extracts plain text from a Teams chatMessage HTML body.
Strategy: replace block-level tags with newlines, replace <at> tags with their visible text, strip all remaining tags, decode entities, collapse runs of whitespace. The result is suitable for sending to the LLM as the user's prompt.
func ToSlackMrkdwn ¶
ToSlackMrkdwn converts standard markdown to Slack mrkdwn format.
func ToTelegramHTML ¶
ToTelegramHTML converts standard markdown to Telegram-compatible HTML.
Types ¶
type TeamsMention ¶
type TeamsMention struct {
ID int `json:"id"`
Text string `json:"mentionText"`
Mentioned struct {
User struct {
ID string `json:"id"`
DisplayName string `json:"displayName"`
} `json:"user"`
} `json:"mentioned"`
}
TeamsMention is the inbound representation of a Microsoft Graph mention entry (mentions[i] in a chatMessage). Only the fields the adapter needs are modelled — extras decode silently.