Closed simonw closed 1 year ago
I think the best way to implement this is at build time, writing out a description field into the database table.
GPT-4 suggestion:
from markdown import markdown
from bs4 import BeautifulSoup
def markdown_to_text(markdown_string):
html = markdown(markdown_string)
text = ''.join(BeautifulSoup(html, "html.parser").stripped_strings)
return text
I have both of those dependencies already.
I use the first paragraph for the summaries on https://til.simonwillison.net/python
I think first paragraph with HTML stripped will work here.
Oops, that triggered a full regeneration of all of the screenshots because the hash of the template file changed.
https://github.com/simonw/til/actions/runs/5092870560/jobs/9154783613
e.g. https://twitter.com/simonw/status/1661869062836846592
HTML is: