inline conversion
This commit is contained in:
parent
9840041158
commit
5922ed2af4
11
index.sh
11
index.sh
|
@ -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)
|
||||
'
|
||||
|
||||
|
|
Loading…
Reference in a new issue