markdown-to-whatsapp

v1.0.3
io.github.drsound/markdown-to-whatsapp Checked 2 days ago Published 3 months ago

Convert Markdown into WhatsApp formatting: tables drawn to fit the phone's monospace width.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

convert_markdown_to_whatsapp Convert Markdown to WhatsApp

Convert Markdown into the formatting WhatsApp renders (*bold*, _italic_, ~strike~, `code`, lists, quotes), ready to paste or send. Use it instead of hand-writing WhatsApp syntax whenever the text has tables, nested lists, headings or inline formatting next to punctuation. It applies WhatsApp's real rules: markers only on word boundaries, escapes that WhatsApp does not interpret, no mid-word formatting. Each table is drawn as a monospace box sized to the reader's phone, degrading in this order: cell padding removed, then borders, then cells word-wrapped. It becomes a bulleted list only when no…

ParameterTypeDescription
markdown *stringThe Markdown text to convert
headingEmojisbooleanPrefix headings with a level emoji (📌 🟠 🟡 …) before the bold text. Default true.
listLayoutstringHow a table reads when it is a list: rows (one group per row), columns (one group per column, for comparison matrices), pairs (bare "key: value" lines, two columns only). auto guesses from the headers…
monoWidthintegerMonospace characters that fit on one line of the reader's WhatsApp bubble; about 26 on a 360 px phone (default 26). Tables are drawn to fit this width.
rowSeparatorbooleanDraw a rule between table rows. Always drawn when a row wraps. Default false.
tableFormatstringauto: a drawn table when it fits monoWidth, a bulleted list otherwise. list: always a bulleted list. Default auto.