1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Drop GitHub-flavored Markdown (py-gfm)

This commit is contained in:
Jeremy Stretch
2020-03-05 16:30:12 -05:00
parent b9d66f010f
commit 363c4acadc
4 changed files with 10 additions and 14 deletions

View File

@ -83,10 +83,6 @@ Pillow
# https://github.com/psycopg/psycopg2 # https://github.com/psycopg/psycopg2
psycopg2-binary psycopg2-binary
# GitHub-flavored Markdown extensions
# https://github.com/zopieux/py-gfm
py-gfm
# Extensive cryptographic library (fork of pycrypto) # Extensive cryptographic library (fork of pycrypto)
# https://github.com/Legrandin/pycryptodome # https://github.com/Legrandin/pycryptodome
pycryptodome pycryptodome

View File

@ -498,14 +498,14 @@ class ExpandableIPAddressField(forms.CharField):
class CommentField(forms.CharField): class CommentField(forms.CharField):
""" """
A textarea with support for GitHub-Flavored Markdown. Exists mostly just to add a standard help_text. A textarea with support for Markdown rendering. Exists mostly just to add a standard help_text.
""" """
widget = forms.Textarea widget = forms.Textarea
default_label = '' default_label = ''
# TODO: Port GFM syntax cheat sheet to internal documentation # TODO: Port Markdown cheat sheet to internal documentation
default_helptext = '<i class="fa fa-info-circle"></i> '\ default_helptext = '<i class="fa fa-info-circle"></i> '\
'<a href="https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet" target="_blank">'\ '<a href="https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet" target="_blank">'\
'GitHub-Flavored Markdown</a> syntax is supported' 'Markdown</a> syntax is supported'
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
required = kwargs.pop('required', False) required = kwargs.pop('required', False)

View File

@ -55,16 +55,17 @@ def getkey(value, key):
return value[key] return value[key]
# TODO: Rename this filter as py-gfm is no longer in use
@register.filter(is_safe=True) @register.filter(is_safe=True)
def gfm(value): def gfm(value):
""" """
Render text as GitHub-Flavored Markdown Render text as Markdown
""" """
# Strip HTML tags # Strip HTML tags
value = strip_tags(value) value = strip_tags(value)
# Render Markdown with GitHub-flavored extension # Render Markdown
html = markdown(value, extensions=['gfm']) html = markdown(value, extensions=['fenced_code'])
return mark_safe(html) return mark_safe(html)
@ -225,8 +226,8 @@ def get_docs(model):
with open(path) as docfile: with open(path) as docfile:
content = docfile.read() content = docfile.read()
# Render Markdown with GFM, admonition # Render Markdown with the admonition extension
content = markdown(content, extensions=['gfm', 'admonition']) content = markdown(content, extensions=['admonition', 'fenced_code'])
return mark_safe(content) return mark_safe(content)

View File

@ -15,11 +15,10 @@ djangorestframework==3.10.3
drf-yasg[validation]==1.17.0 drf-yasg[validation]==1.17.0
gunicorn==20.0.4 gunicorn==20.0.4
Jinja2==2.10.3 Jinja2==2.10.3
Markdown==2.6.11 Markdown==3.2.1
netaddr==0.7.19 netaddr==0.7.19
Pillow==7.0.0 Pillow==7.0.0
psycopg2-binary==2.8.4 psycopg2-binary==2.8.4
py-gfm==0.1.4
pycryptodome==3.9.4 pycryptodome==3.9.4
PyYAML==5.3 PyYAML==5.3
redis==3.3.11 redis==3.3.11