From 847b783ea3ece7378ea99573377f5f7052f14140 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Thu, 11 May 2017 13:19:14 +0100 Subject: [PATCH] Check / fix support for remote images --- md_pdf/build/template.py | 4 +++- test-files/3-image.md | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/md_pdf/build/template.py b/md_pdf/build/template.py index 15803b2..2d89308 100644 --- a/md_pdf/build/template.py +++ b/md_pdf/build/template.py @@ -22,7 +22,9 @@ def add_base_tag(doc, config): logger.debug("Adding Base Tag...") soup = BeautifulSoup(doc, 'html.parser') for img in soup.findAll('img'): - img['src'] = os.path.abspath(img['src']) + abs_path = os.path.abspath(img['src']) + if os.path.isfile(abs_path): + img['src'] = abs_path return soup.prettify() diff --git a/test-files/3-image.md b/test-files/3-image.md index 0716ec0..88c3a36 100644 --- a/test-files/3-image.md +++ b/test-files/3-image.md @@ -2,3 +2,6 @@ ![title](./test-image.png) + + +![Example remote image](http://image.spreadshirtmedia.com/image-server/v1/designs/11735885,width=178,height=178/TV-Test-Screen.png)