raycast / script-commands

Script Commands let you tailor Raycast to your needs. Think of them as little productivity boosts throughout your day.
https://raycast.com
MIT License
5.99k stars 887 forks source link

Script for convert Markdown formatting to Telegram format #936

Closed borzov closed 5 months ago

borzov commented 6 months ago

Description

This script converts Markdown-formatted text into a Telegram-compatible format. It automatically transforms various Markdown formatting elements, such as headers, bold, italic, strikethrough, spoilers, underline, links, and inline code, into their corresponding Telegram formatting tags. The script also adds emojis before different header levels and inserts empty lines between paragraphs to improve readability.

This tool is particularly useful for those who frequently work with Markdown documentation and want to quickly share it on Telegram while preserving most of the original formatting. Instead of manually altering the syntax for each formatting element, users can simply copy their Markdown text, run this script, and have the formatted version ready to paste directly into a Telegram chat, saving time and effort.

Type of change

Dependencies / Requirements

The script relies on the following built-in Python libraries for its functionality on macOS:

  1. re: This library is used for regular expressions, which are essential for searching and replacing Markdown formatting elements with their Telegram counterparts.

  2. subprocess: This library is used to interact with the macOS clipboard through the pbpaste and pbcopy command-line utilities. It allows the script to read Markdown text from the clipboard and write the converted text back to the clipboard.

No additional third-party libraries are required, as the script utilizes the built-in re and subprocess libraries, making it easy to set up and use on macOS systems with Python installed.

Checklist

borzov commented 5 months ago

Thank you, I agree with all the edits. Today I will make a new pull request including your comments.