Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

1.6 KB
Raw Blame
"""WeChat markdown formatter.

WeChat personal messages support only plain text — no bold, italic,
strikethrough, or clickable hyperlinks.  This formatter passes text
through as-is and renders links as ``text (url)`` so the URL is still
visible to the user.
"""

from .base_formatter import BaseMarkdownFormatter


class WeChatFormatter(BaseMarkdownFormatter):
    """WeChat plain-text formatter.

    WeChat personal chat does not support rich markdown formatting,
    so all style methods return undecorated text.  Links are shown
    inline as ``text (url)`` since clickable hyperlinks are not
    available.
    """

    def format_bold(self, text: str) -> str:
        return text

    def format_italic(self, text: str) -> str:
        return text

    def format_strikethrough(self, text: str) -> str:
        return text

    def format_link(self, text: str, url: str) -> str:
        return f"{text} ({url})"

    def format_code_inline(self, text: str) -> str:
        # No inline code styling in plain text; return as-is
        return text

    def format_code_block(self, code: str, language: str = "") -> str:
        # Render code blocks as plain indented text
        return code

    def format_quote(self, text: str) -> str:
        lines = text.split("\n")
        return "\n".join(f"> {line}" for line in lines)

    def format_list_item(self, text: str, level: int = 0) -> str:
        indent = "  " * level
        return f"{indent}- {text}"

    def format_numbered_list_item(self, text: str, number: int, level: int = 0) -> str:
        indent = "  " * level
        return f"{indent}{number}. {text}"