Hello developers,
Have you ever needed to convert Markdown text to a bold/italic text that you can post to Facebook, Instagram ?
Hereβs how it works:
- It looks through
text
for any parts that are wrapped in**bold text**
. - Using regex, it breaks up each segment into "normal" and "bold" parts.
- Each letter in the bold section gets replaced with its corresponding Unicode "bold" version. For example,
A
becomes a Unicode-boldπ
, anda
becomesπ
. - Finally, it puts everything back together and gives you the bolded version of the whole text.
This script is perfect for converting text so that it looks bold across platforms that donβt directly support rich text formatting, like some messaging apps. Simple and effective!
Side Notes:
If you need to get the Html output of some formatted text, use CopyQ. Windows have similar "buffer" tools like Free Clipboard Viewer
VSCode have "Paste" extension that allows you to paste different format of the Clipboard content.
Also, for VSCode, you have extensions for converting Markdown to Html and vice verse.
Take a look at the code comment if you want to extent the script to process
Italic
orBold and Italic
text.
Top comments (0)