Skip to content

Telegram bridge: dollar signs stripped by Markdown/LaTeX parsing #17

@hegelstad

Description

@hegelstad

Problem

When sending messages via h2 send telegram, dollar signs ($) in message text are stripped/eaten. For example, $200 disappears entirely from the rendered message.

This appears to be caused by Telegram interpreting $ as a LaTeX/math delimiter when using MarkdownV2 parse mode.

Expected behavior

Dollar signs in message text should be preserved and displayed correctly, regardless of which parse mode is used.

Workaround

Using --format HTML avoids the issue since HTML parse mode doesn't treat $ as special. Writing out "dollar" instead of using the symbol also works.

Suggested fix

Options:

  1. Escape $ characters when using MarkdownV2 parse mode (prepend with \)
  2. Default to HTML parse mode for the Telegram bridge
  3. Auto-detect and escape special characters based on the active parse mode

Reproduction

h2 send telegram "This costs $200 per month"

[ubuntu] This costs 00 per month

The message arrives as: "This costs 200 per month" (dollar sign missing).

Environment

  • h2 v0.3.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions