{"id":50309672,"url":"https://github.com/tejasambhore/whatsapp_formatter","last_synced_at":"2026-05-28T20:01:14.056Z","repository":{"id":333861907,"uuid":"1139013748","full_name":"TejasAmbhore/whatsapp_formatter","owner":"TejasAmbhore","description":"Convert Markdown and HTML to WhatsApp formatting in Python ","archived":false,"fork":false,"pushed_at":"2026-02-09T11:19:57.000Z","size":24,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-04T02:15:30.564Z","etag":null,"topics":["chatbot","converter","formatter","html","markdown","messaging","python","text-formatting","whatsapp","whatsapp-api"],"latest_commit_sha":null,"homepage":"https://github.com/TejasAmbhore/whatsapp_formatter","language":"Python","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/TejasAmbhore.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-21T12:08:49.000Z","updated_at":"2026-03-16T14:56:26.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/TejasAmbhore/whatsapp_formatter","commit_stats":null,"previous_names":["tejasambhore/whatsapp_formatter"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/TejasAmbhore/whatsapp_formatter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TejasAmbhore%2Fwhatsapp_formatter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TejasAmbhore%2Fwhatsapp_formatter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TejasAmbhore%2Fwhatsapp_formatter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TejasAmbhore%2Fwhatsapp_formatter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TejasAmbhore","download_url":"https://codeload.github.com/TejasAmbhore/whatsapp_formatter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TejasAmbhore%2Fwhatsapp_formatter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33624221,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-28T02:00:06.440Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["chatbot","converter","formatter","html","markdown","messaging","python","text-formatting","whatsapp","whatsapp-api"],"created_at":"2026-05-28T20:01:04.977Z","updated_at":"2026-05-28T20:01:14.044Z","avatar_url":"https://github.com/TejasAmbhore.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# py-whatsapp-formatter: Python Library for WhatsApp Text Formatting\n\n**Convert Markdown and HTML to WhatsApp formatting in Python** — A lightweight, zero-dependency library for bidirectional conversion between WhatsApp, Markdown, and HTML text formatting. Perfect for WhatsApp chatbots, messaging automation, WhatsApp Business API integrations, and any application that needs to format text for WhatsApp messages.\n\n**Key Features:**\n- 🔄 Bidirectional conversion (to and from WhatsApp format)\n- 📝 Supports Markdown ↔ WhatsApp and HTML ↔ WhatsApp\n- 🎯 Zero dependencies, fully typed\n- ⚡ Fast and lightweight\n- 🔗 Handles nested formatting correctly\n\n## Installation\n\n```bash\npip install py-whatsapp-formatter\n```\n\n## Use Cases\n\n- **WhatsApp Chatbots**: Format bot responses with proper WhatsApp styling\n- **WhatsApp Business API**: Convert rich text to WhatsApp-compatible format\n- **Content Management**: Transform CMS content (HTML/Markdown) for WhatsApp\n- **Message Automation**: Programmatically format WhatsApp messages\n- **AI Chat Integration**: Convert ChatGPT/Claude markdown responses to WhatsApp format\n\n## Usage\n\n### Convert to WhatsApp Format\n\n```python\nfrom whatsapp_formatter import convert_markdown_to_whatsapp, convert_html_to_whatsapp\n\n# Convert Markdown to WhatsApp format\ntext = convert_markdown_to_whatsapp(\"**Bold** and *italic* and ~~strikethrough~~\")\n# Output: \"*Bold* and _italic_ and ~strikethrough~\"\n\n# Convert HTML to WhatsApp format\ntext = convert_html_to_whatsapp(\"\u003cstrong\u003eBold\u003c/strong\u003e \u003cem\u003eitalic\u003c/em\u003e\")\n# Output: \"*Bold* _italic_\"\n```\n\n### Convert from WhatsApp Format\n\n```python\nfrom whatsapp_formatter import convert_whatsapp_to_markdown, convert_whatsapp_to_html\n\n# Convert WhatsApp to Markdown format\ntext = convert_whatsapp_to_markdown(\"*Bold* and _italic_ and ~strikethrough~\")\n# Output: \"**Bold** and *italic* and ~~strikethrough~~\"\n\n# Convert WhatsApp to HTML format\ntext = convert_whatsapp_to_html(\"*Bold* and _italic_ and ~strikethrough~\")\n# Output: \"\u003cstrong\u003eBold\u003c/strong\u003e and \u003cem\u003eitalic\u003c/em\u003e and \u003cdel\u003estrikethrough\u003c/del\u003e\"\n```\n\n## WhatsApp Formatting Reference\n\n| Format | WhatsApp | Markdown | HTML |\n|--------|----------|----------|------|\n| Bold | `*text*` | `**text**` | `\u003cb\u003e`, `\u003cstrong\u003e` |\n| Italic | `_text_` | `*text*` | `\u003ci\u003e`, `\u003cem\u003e` |\n| Strikethrough | `~text~` | `~~text~~` | `\u003cs\u003e`, `\u003cstrike\u003e`, `\u003cdel\u003e` |\n| Monospace | `` `text` `` | `` `text` `` | `\u003ccode\u003e` |\n| Code block | ` ```text``` ` | ` ```text``` ` | `\u003cpre\u003e\u003ccode\u003e` |\n\nAll conversions are bidirectional. Nested formatting is supported (e.g., `*_bold and italic_*`).\n\n## Advanced Usage\n\nFor more control, use the converter classes directly:\n\n```python\nfrom whatsapp_formatter import (\n    MarkdownToWhatsAppConverter,\n    HTMLToWhatsAppConverter,\n    WhatsAppToMarkdownConverter,\n    WhatsAppToHTMLConverter,\n)\n\n# Custom Markdown converter with post-processing\nconverter = MarkdownToWhatsAppConverter()\nconverter.add_post_processor(lambda x: x.strip())\nresult = converter.convert(\"  **Hello**  \")\n\n# HTML converter without tag stripping\nconverter = HTMLToWhatsAppConverter(strip_remaining_tags=False)\nresult = converter.convert(\"\u003cb\u003eBold\u003c/b\u003e \u003cspan\u003ekept\u003c/span\u003e\")\n\n# WhatsApp to Markdown\nconverter = WhatsAppToMarkdownConverter()\nresult = converter.convert(\"*bold* _italic_ ~strike~\")\n# Output: \"**bold** *italic* ~~strike~~\"\n\n# WhatsApp to HTML (with optional line break conversion)\nconverter = WhatsAppToHTMLConverter(include_line_breaks=True)\nresult = converter.convert(\"*bold*\\n_italic_\")\n# Output: \"\u003cstrong\u003ebold\u003c/strong\u003e\u003cbr\u003e\\n\u003cem\u003eitalic\u003c/em\u003e\"\n```\n\n## Requirements\n\n- Python 3.9+\n- No external dependencies\n\n## License\n\nMIT License\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftejasambhore%2Fwhatsapp_formatter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftejasambhore%2Fwhatsapp_formatter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftejasambhore%2Fwhatsapp_formatter/lists"}