Fix image loading.

This commit is contained in:
jmsgrogan 2024-02-17 17:56:17 +00:00
parent f482cb562b
commit ff7c31701e
6 changed files with 59 additions and 5 deletions

1
test/requirements.txt Normal file
View file

@ -0,0 +1 @@
pytest

14
test/test_img_replace.py Normal file
View file

@ -0,0 +1,14 @@
import markdown
from bs4 import BeautifulSoup
md_input = """This is an image of a tree: ![tree image](tree_img)
"""
def test_image_replace():
soup = BeautifulSoup(markdown.markdown(md_input), features="html.parser")
for img in soup.find_all('img'):
img["src"] = "blah"
print(soup.prettify())