Skip to content

Instantly share code, notes, and snippets.

View fronchetti's full-sized avatar

Felipe Fronchetti fronchetti

View GitHub Profile
@fronchetti
fronchetti / markdown_to_text.py
Created July 5, 2022 19:35 — forked from lorey/markdown_to_text.py
Markdown to Plaintext in Python
from bs4 import BeautifulSoup
from markdown import markdown
def markdown_to_text(markdown_string):
""" Converts a markdown string to plaintext """
# md -> html -> text since BeautifulSoup can extract text cleanly
html = markdown(markdown_string)
# remove code snippets