diff --git a/base_requirements.txt b/base_requirements.txt index ab33b1c06..f5a4a8685 100644 --- a/base_requirements.txt +++ b/base_requirements.txt @@ -83,10 +83,6 @@ Pillow # https://github.com/psycopg/psycopg2 psycopg2-binary -# GitHub-flavored Markdown extensions -# https://github.com/zopieux/py-gfm -py-gfm - # Extensive cryptographic library (fork of pycrypto) # https://github.com/Legrandin/pycryptodome pycryptodome diff --git a/netbox/utilities/forms.py b/netbox/utilities/forms.py index c57996a43..8825102d1 100644 --- a/netbox/utilities/forms.py +++ b/netbox/utilities/forms.py @@ -498,14 +498,14 @@ class ExpandableIPAddressField(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 default_label = '' - # TODO: Port GFM syntax cheat sheet to internal documentation + # TODO: Port Markdown cheat sheet to internal documentation default_helptext = ' '\ ''\ - 'GitHub-Flavored Markdown syntax is supported' + 'Markdown syntax is supported' def __init__(self, *args, **kwargs): required = kwargs.pop('required', False) diff --git a/netbox/utilities/templatetags/helpers.py b/netbox/utilities/templatetags/helpers.py index 4d957b63f..a57cfc66d 100644 --- a/netbox/utilities/templatetags/helpers.py +++ b/netbox/utilities/templatetags/helpers.py @@ -55,16 +55,17 @@ def getkey(value, key): return value[key] +# TODO: Rename this filter as py-gfm is no longer in use @register.filter(is_safe=True) def gfm(value): """ - Render text as GitHub-Flavored Markdown + Render text as Markdown """ # Strip HTML tags value = strip_tags(value) - # Render Markdown with GitHub-flavored extension - html = markdown(value, extensions=['gfm']) + # Render Markdown + html = markdown(value, extensions=['fenced_code']) return mark_safe(html) @@ -225,8 +226,8 @@ def get_docs(model): with open(path) as docfile: content = docfile.read() - # Render Markdown with GFM, admonition - content = markdown(content, extensions=['gfm', 'admonition']) + # Render Markdown with the admonition extension + content = markdown(content, extensions=['admonition', 'fenced_code']) return mark_safe(content) diff --git a/requirements.txt b/requirements.txt index d8e704874..459515c96 100644 --- a/requirements.txt +++ b/requirements.txt @@ -15,11 +15,10 @@ djangorestframework==3.10.3 drf-yasg[validation]==1.17.0 gunicorn==20.0.4 Jinja2==2.10.3 -Markdown==2.6.11 +Markdown==3.2.1 netaddr==0.7.19 Pillow==7.0.0 psycopg2-binary==2.8.4 -py-gfm==0.1.4 pycryptodome==3.9.4 PyYAML==5.3 redis==3.3.11