First, we used two caches. Turns out that lru_cache wasn't needed, the
dict works perfectly fine on it's own.
Second, we now also cache local images, so that we don't have to read
them off the filesystem and convert them to base64 on every keystroke
Maybe there should be a maximum size on that cache dict, but I doubt
anyone would actually run into any trouble this cache taking too much
ram.
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
The aim is to replace every \n in a <pre> with a <br /> because st
doesn't support pre.
However, ST doesn't support <br/> for some reason, only <br> or <br />.
We use to add some <br>s, but BeautifulSoup automatically adds a <br/>
when it sees a <br> (close the tag), which causes the clipping of the
rest of the file by ST. But if we replace every \n with a <br />,
BeautifulSoup automatically replaces it with <br/> (= ST bug)
So, we do exactly that, except that at the very end, when markdown2html
returns, we replace every <br/> with a <br />
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