Skip to content

Commit

Permalink
Fixed encoding issue under Python 2, thanks to Ikrami Ahmad
Browse files Browse the repository at this point in the history
  • Loading branch information
aaclause committed Aug 14, 2019
1 parent 68a1bba commit 8c16669
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions addon/globalPlugins/markdownForever/__init__.py
Expand Up @@ -61,8 +61,7 @@ def getText():

def md2HTML(md):
res = markdown2.markdown(md, extras=["footnotes", "tables", "toc", "fenced-code-blocks", "task_list"])
if isPy3: toc = (res.toc_html if res.toc_html and res.toc_html.count("<li>") > 1 else '')
else: toc = (res.toc_html.encode("UTF-8") if res.toc_html else '')
toc = (res.toc_html if res.toc_html and res.toc_html.count("<li>") > 1 else '')
if toc: toc = ("<h1>%s</h1>" % _("Table of contents")) + toc
if isPy3: return res, toc
else: return res.encode("UTF-8"), toc.encode("UTF-8")
Expand Down

0 comments on commit 8c16669

Please sign in to comment.