新增企业微信、微博、WhatsApp、Workplace 四个渠道扩展。 企业微信渠道扩展主要模块:config, gateway, webhook, webhook_bot, outbound, streaming, pairing, security, crypto, dedupe, persistent_dedupe, card, directory, events, externalcontact, media, mentions, menu, message, oauth, status 微博渠道扩展主要模块:config, gateway, webhook, outbound, streaming, pairing, security, dedupe, passive_reply, broadcast, message, menu, media, subscription, template, status WhatsApp 渠道扩展主要模块:config, gateway, webhook, outbound, streaming, pairing, security, dedupe, actions, monitor, status Workplace 渠道扩展主要模块:config, gateway, webhook, outbound, streaming, pairing, security, dedupe, actions, challenge, groups, media, mentions, menu, monitor, persona, quick_reply, signature, subscriptions, template, threading, users, status
23 lines
560 B
Python
23 lines
560 B
Python
import re
|
|
|
|
|
|
def markdown_to_native(md_text: str) -> str:
|
|
text = md_text
|
|
|
|
text = re.sub(r"!\[[^\]]*\]\([^)]*\)", "", text)
|
|
|
|
text = re.sub(r"^#{1,6}\s+(.+)$", r"*\1*", text, flags=re.MULTILINE)
|
|
|
|
text = re.sub(r"\[([^\]]+)\]\(([^)]+)\)", r"\1 (\2)", text)
|
|
|
|
return text.strip()
|
|
|
|
|
|
def native_to_markdown(native_content: dict | str) -> str:
|
|
if isinstance(native_content, dict):
|
|
return native_content.get("text", "")
|
|
return str(native_content)
|
|
|
|
|
|
def markdown_to_whatsapp(md_text: str) -> str:
|
|
return markdown_to_native(md_text) |