diff --git a/404.png b/404.png new file mode 100644 index 0000000..af1ef6a Binary files /dev/null and b/404.png differ diff --git a/MarkdownLivePreview.tasks b/MarkdownLivePreview.tasks index 2c20529..a70969c 100644 --- a/MarkdownLivePreview.tasks +++ b/MarkdownLivePreview.tasks @@ -1,11 +1,10 @@ todo: - - ☐ add message in status bar @notGoodIdea - ☐ add **custom css** feature - ☐ sync scroll + ☐ sync scroll @needsUpdate + ☐ load images from internet (`https:`) ☐ regive focus to the right markdown view ☐ set the title of the preview ☐ disable previewing when the preview is closed ☐ preview.set_scratch(True) + ☐ add 404 image diff --git a/md_in_popup.py b/md_in_popup.py index 23ffac3..f1ea835 100644 --- a/md_in_popup.py +++ b/md_in_popup.py @@ -34,6 +34,9 @@ def get_content_till(string, char_to_look_for, start=0): return string[start:i], i def to_base64(path): + if not os.path.exists(path): + return to_base64(os.path.join(os.path.dirname(__file__), '404.png')) + with open(path, 'rb') as fp: content = fp.read() return base64.standard_b64encode(content) diff --git a/sample.md b/sample.md index ecf9c20..9e4ea8a 100644 --- a/sample.md +++ b/sample.md @@ -1 +1,3 @@ -![my_img](C:\Users\math\Pictures\Img-style\ASCII.png) +![my_img](C:\Users\math\Pictures\Img-style\Fencedf.png) + +this is a test