1
Fork 0

inline conversion

This commit is contained in:
Jan-Erik Rediger 2022-04-22 23:49:06 +02:00
parent 9840041158
commit 5922ed2af4

View file

@ -26,10 +26,9 @@ sqlite-utils convert "$DATABASE_PATH" posts text '
from markdown import Markdown
import io
__md = None
def convert(text):
global Markdown
def define():
global __md
def unmark_element(element, stream=None):
global io
if stream is None:
@ -43,13 +42,9 @@ def define():
return stream.getvalue()
Markdown.output_formats["plain"] = unmark_element
__md = Markdown(output_format="plain")
__md.stripTopLevelTags = False
define()
def convert(text):
global __md
return __md.convert(text)
'