Skip to content

Commit

Permalink
Replace cgi module (#177)
Browse files Browse the repository at this point in the history
`cgi.escape` is already deprecated in python 3.3 and no longer available in 3.8

This commit is required to run the plugin on python 3.8 plguin-host
  • Loading branch information
deathaxe authored Jan 16, 2024
1 parent b4b574f commit eb98d1b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions markdown_preview.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import json
import time
import codecs
import cgi
import html
import yaml
import textwrap
from collections import OrderedDict
Expand Down Expand Up @@ -528,7 +528,7 @@ def get_title(self):
if not title:
fn = self.view.file_name()
title = 'untitled' if not fn else os.path.splitext(os.path.basename(fn))[0]
return '<title>%s</title>' % cgi.escape(title)
return '<title>%s</title>' % html.escape(title)

def get_meta(self):
"""Get meta data."""
Expand All @@ -547,7 +547,7 @@ def get_meta(self):
v = ','.join(v)
if v is not None:
meta.append(
'<meta name="%s" content="%s">' % (cgi.escape(k, True), cgi.escape(v, True))
'<meta name="%s" content="%s">' % (html.escape(k, True), html.escape(v, True))
)
return '\n'.join(meta)

Expand Down

0 comments on commit eb98d1b

Please sign in to comment.