{"id":20335582,"url":"https://github.com/aliwoto/mdparser","last_synced_at":"2026-04-12T15:22:59.720Z","repository":{"id":57619239,"uuid":"389040522","full_name":"ALiwoto/mdparser","owner":"ALiwoto","description":"mdparser for telegram API using MarkDownV2.","archived":false,"fork":false,"pushed_at":"2024-08-27T07:12:11.000Z","size":51,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-11T22:06:42.317Z","etag":null,"topics":["bot","bot-api","markdown","markdown-v2","telegram","telegram-bot","telegram-bot-api"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ALiwoto.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-07-24T08:14:13.000Z","updated_at":"2024-08-28T15:00:56.000Z","dependencies_parsed_at":"2024-11-19T01:44:11.101Z","dependency_job_id":null,"html_url":"https://github.com/ALiwoto/mdparser","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ALiwoto%2Fmdparser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ALiwoto%2Fmdparser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ALiwoto%2Fmdparser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ALiwoto%2Fmdparser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ALiwoto","download_url":"https://codeload.github.com/ALiwoto/mdparser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248487715,"owners_count":21112191,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bot","bot-api","markdown","markdown-v2","telegram","telegram-bot","telegram-bot-api"],"created_at":"2024-11-14T20:42:17.202Z","updated_at":"2026-04-12T15:22:59.707Z","avatar_url":"https://github.com/ALiwoto.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!--\n\tmdparser library Project\n\tCopyright (C) 2021-2026 ALiwoto\n\tThis file is subject to the terms and conditions defined in\n\tfile 'LICENSE', which is part of the source code.\n--\u003e\n\n# mdparser\nmdparser for telegram bot API\n\n\u003chr/\u003e\n\n## How to use\nFirst you need to get the package:\n`go get -u github.com/ALiwoto/mdparser`\n\nthen you can use the package like this:\n\n```go\nimport \"github.com/ALiwoto/mdparser\"\n\n\n\nfunc sendMessage(msg Message) {\n\tmd := mdparser.GetBold(\"This is a message\")\n\tmd.Normal(\":\\n\")\n\tmd.Italic(\"Italic\\n\")\n\tmd.Styled(\"Bold + Italic\\n\", mdparser.StyleBold, mdparser.StyleItalic)\n\tmd.Mono(\"Mono space\\n\")\n\tmd.CodeBlockLang(\"go\", \"fmt.Println(\\\"hello\\\")\")\n\tmd.HyperLink(\"text\", \"https://google.com\")\n\n\tmsg.Reply(md.ToString(), options{version: \"MarkdownV2\"})\n}\n\n\n```\n\nAll instance methods mutate the current markdown. If you need a copy first, clone explicitly:\n\n```go\nbase := mdparser.GetNormal(\"hello\")\ncopy := base.Clone().Bold(\" world\")\n```\n\n## Nesting Format Entities\n\nTelegram officially documents nested message entities in the Bot API docs:\n\n- [Bot API: Formatting options](https://core.telegram.org/bots/api#formatting-options)\n- [Bot API: MessageEntity](https://core.telegram.org/bots/api#messageentity)\n- [Bot API changelog: version 4.5](https://core.telegram.org/bots/api-changelog#version-4-5)\n\nImportant rules from the official docs:\n\n- Nested entities are supported, but if two entities overlap, one must fully contain the other.\n- `bold`, `italic`, `underline`, `strike-through`, and `spoiler` may be nested in each other.\n- `code` and `pre` are special and have stricter nesting limits.\n- Legacy `Markdown` is limited; use `MarkdownV2` if you need modern formatting behavior.\n\nThat means combined formatting is real and officially supported. For example, bold + italic on the same words is valid when represented according to Telegram's nesting rules.\n\n## Migrating From Old Versions\n\nCurrent rule:\n\n- `Clone()` is the only copy operation.\n- All other instance methods mutate the receiver.\n\nRemoved methods:\n\n- `AppendThis`\n- `AppendNormal`\n- `AppendBold`\n- `AppendItalic`\n- `AppendMono`\n- `AppendUnderline`\n- `AppendStrike`\n- `AppendHyperLink`\n- `AppendMention`\n- `AppendSpoiler`\n- `ReplaceMdThis`\n- `ReplaceMdThisN`\n- `ElThis`\n- `SpaceThis`\n- `TabThis`\n\nReplacement pattern:\n\n- Use the non-`This` method directly for mutation.\n- If old code expected copy-style behavior, call `Clone()` first.\n\nExamples:\n\n- `md.AppendBold(\"x\")` -\u003e `md.Clone().Bold(\"x\")`\n- `md.AppendBoldThis(\"x\")` -\u003e `md.Bold(\"x\")`\n- `md.AppendThis(other)` -\u003e `md.Append(other)`\n- `md.ReplaceMdThis(old, new)` -\u003e `md.ReplaceMd(old, new)`\n- `md.ElThis()` -\u003e `md.El()`\n\nBehavior changes:\n\n- `Append`\n- `ReplaceMd`\n- `ReplaceMdN`\n- `ReplaceToNew`\n- `ReplaceToNewN`\n- `El`\n- `Space`\n- `Tab`\n\nThese methods still exist, but they now mutate the current markdown. If older code relied on copy-style behavior, migrate to `md.Clone().SomeMethod(...)`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faliwoto%2Fmdparser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faliwoto%2Fmdparser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faliwoto%2Fmdparser/lists"}