# -*- encoding: utf-8 -*-
import base64
import os.path
import sublime
import re
from .image_manager import ImageManager
def plugin_loaded():
global error404, loading
loading = sublime.load_resource('Packages/MarkdownLivePreview/loading.txt')
error404 = sublime.load_resource('Packages/MarkdownLivePreview/404.txt')
def replace_img_src_base64(html, basepath):
"""Really messy, but it works (should be updated)"""
index = -1
tag_start = ' blocks
this function replaces every \n with a
in a
"""
while True:
obj = re.search(r'(.*?)
', html, re.DOTALL)
if not obj:
break
html = list(html)
html[obj.start(0):obj.end(0)] = '' + ''.join(html[obj.start(1):obj.end(1)]) \
.replace('\n', '
') \
.replace(' ', ' ') + ''
html = ''.join(html)
return html