15 Commits

Author SHA1 Message Date
e462e8b3bc ImageLoader: spawn one thread per image. fix #93
In the process of fixing #93, I realized that we were spawning new
threads to fetch images for each update (we only need one).
2019-11-16 15:54:22 +11:00
cf68b2c202 Set the maxwidth for images (fix #48)
It didn't look pretty when images where larger than the viewport, and it
"broke" word wrap (because it stretched the phantom, and hence lines
wrapped further, see #34)

Sublime Text's minihtml only supports width and height attributes on
img tags, therefore, we have to determine the aspect ratio of the images
ourselves if we want to set a maxsize (so that we can set the height).

We use a hacky function copy pasted from stackoverflow to determine the
size of common format of images using std lib python.
2019-11-16 14:56:03 +11:00
c10bc95e54 remove utils.py file; use a setting file for delay between updates
utils.py contained two functions. One which wasn't used, and another,
get_settings() which I moved to MarkdownLivePreview.py

Add an entry to the command palette to edit the settings
2019-11-16 14:19:46 +11:00
84fb15aec3 update stylesheet to spread pre blocks (fix #56) 2019-11-16 11:16:58 +11:00
04989f8660 Use cuddled-lists options on markdown2 (fix #82) 2019-11-16 10:41:23 +11:00
c6ac821c4a Merge remote-tracking branch 'update/master'
This is a weird merge. I had re-written everything in a separate
repository, and basically wanted that new repo (update) to be the new
master of this repository, whilst preserving the history of the update
repo.

Here's what I did:

$ git remote add update <path to update>
$ git fetch update
$ git merge -X theirs --allow-unrelated-histories update/master
$ # remove extra files
$ git commit --amend
2019-11-16 09:31:39 +11:00
c14c28b56b fix the flickering by delaying and throwing
Explanation coming on my blog, math2001.github.io, something like
"lessons learned from re writing MarkdownLivePreview"
2019-11-16 07:50:55 +11:00
e3896a6b3d fix indentation in pre in preview
Again, this is a dodgy hack: replace spaces with dot with the color
exactly like the background, because otherwise ST ignores it, even in
pre
2019-11-15 15:02:31 +11:00
6016f07cd1 add line breaks for pre 2019-11-15 14:52:20 +11:00
c0c9867cc8 move resources.py to MarkdownLivePreview.py
Having an extra file is just a pain because you have to save it manually
for ST to reload, and it was small and created way more trouble than it
needed to... It fits really nicely in there anyway

And add some nice CSS
2019-11-15 13:33:58 +11:00
5f2cac54e8 use a resource system to load images and stylesheet 2019-11-15 07:21:41 +11:00
8c1012eb8c Remove entry in phantom_sets when markdown_view is closed
Otherwise the object would keep on growing forever. It probably would
never ever be a problem for anyone, but it just makes me feel better
2019-11-14 21:33:37 +11:00
cc28bfef96 clean up code; support code block; add few FIXMEs 2019-11-14 21:14:20 +11:00
ef9b2daf6d Load images from the internet using an in memory cache
As soon as the plugin is reloaded, or the editor restarted, the images
must be reloaded. Maybe we could use a file cache...
2019-11-14 19:30:26 +11:00
bae26fc452 Viewing images works for local files
We have to make sure that everything is converted to base64 (and
replaced in the src attribute) because otherwise ST3 messes up the
height of the images
2019-11-14 17:28:47 +11:00