Documentation ¶
Overview ¶
Package tgmarkup provides functionality to convert Markdown text to Telegram-flavored message markup.
Index ¶
Constants ¶
const ( Mention = "mention" // @username Hashtag = "hashtag" // #hashtag Cashtag = "cashtag" // $USD BotCommand = "bot_command" // /start@jobs_bot URL = "url" // https://telegram.org Email = "email" // do-not-reply@telegram.org PhoneNumber = "phone_number" // +1-212-555-0123 Bold = "bold" Italic = "italic" Underline = "underline" Strikethrough = "strikethrough" Spoiler = "spoiler" Blockquote = "blockquote" ExpandableBlockquote = "expandable_blockquote" Code = "code" // monowidth string Pre = "pre" // monowidth block TextLink = "text_link" TextMention = "text_mention" CustomEmoji = "custom_emoji" )
Constants for various Telegram message entity types. See https://core.telegram.org/bots/api#messageentity for a complete list of supported types.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Entity ¶
type Entity struct { Type string `json:"type" starlark:"type"` // Offset in UTF-16 code units to the start of the entity. Offset int `json:"offset" starlark:"offset"` // Length of the entity in UTF-16 code units. Length int `json:"length" starlark:"length"` // Optional. For “text_link” only, URL that will be opened after user taps on // the text. URL string `json:"url,omitempty" starlark:"url"` // Optional. For “pre” only, the programming language of the entity text. Language string `json:"language,omitempty" starlark:"language"` }
Entity defines the type and location of a formatted part of the message text. See https://core.telegram.org/bots/api#messageentity.
type Message ¶
type Message struct { Text string `json:"text" starlark:"text"` Entities []Entity `json:"entities" starlark:"entities"` }
Message represents a Telegram message with text and entities for formatting. It is designed to be marshaled into JSON for use with the Telegram Bot API. See https://core.telegram.org/bots/api#message for more information.
func FromMarkdown ¶
FromMarkdown converts a Markdown text to a Message.