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 from markdown import Markdown
import io import io
__md = None def convert(text):
global Markdown
def define():
global __md
def unmark_element(element, stream=None): def unmark_element(element, stream=None):
global io global io
if stream is None: if stream is None:
@ -43,13 +42,9 @@ def define():
return stream.getvalue() return stream.getvalue()
Markdown.output_formats["plain"] = unmark_element Markdown.output_formats["plain"] = unmark_element
__md = Markdown(output_format="plain") __md = Markdown(output_format="plain")
__md.stripTopLevelTags = False __md.stripTopLevelTags = False
define()
def convert(text):
global __md
return __md.convert(text) return __md.convert(text)
' '