Let me assure you that your desire to emancipate your text from the shackles of markdown is not merely a frivolous whim, but a pursuit of the highest aesthetic order. Obsidian, while a darling for organization, can leave one’s prose looking like a crumpled discount bin frock.
With a Sprinkle of Techno Dust,
Tanuki505
import pyperclip
import markdown
from bs4 import BeautifulSoup
def convert_clipboard_content_to_text():
"""
This script converts the content from the clipboard, assumed to be markdown, to plain text and saves it to a file.
Installation:
1. Make sure Python is installed on your system. If not, download and install Python from https://www.python.org/downloads/
2. Install the required Python packages by running the following command in your command prompt or terminal:
pip install markdown beautifulsoup4 pyperclip
Usage:
1. Copy the markdown content you want to convert to your clipboard. You can do this by selecting the text and pressing Ctrl+C (or Command+C on a Mac). windows + v for clipboard history.
2. Run this script by typing the following command in your command prompt or terminal and pressing Enter:
python convert_clipboard_md_to_text.py
3. The script will convert the markdown content from your clipboard to plain text and save it to the clipboard.
"""
# Get markdown content from clipboard
markdown_content = pyperclip.paste()
# Convert markdown to HTML
html_content = markdown.markdown(markdown_content)
# Extract text from HTML
text_content = ''.join(BeautifulSoup(html_content, "html.parser").findAll(string=True))
# put the content on the clipboard
pyperclip.copy(text_content)
if __name__ == "__main__":
convert_clipboard_content_to_text()