Преглед изворни кода

Drop GitHub-flavored Markdown (py-gfm)

Jeremy Stretch пре 6 година
родитељ
комит
363c4acadc
4 измењених фајлова са 10 додато и 14 уклоњено
  1. 0 4
      base_requirements.txt
  2. 3 3
      netbox/utilities/forms.py
  3. 6 5
      netbox/utilities/templatetags/helpers.py
  4. 1 2
      requirements.txt

+ 0 - 4
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

+ 3 - 3
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 = '<i class="fa fa-info-circle"></i> '\
                        '<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):
         required = kwargs.pop('required', False)

+ 6 - 5
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)
 

+ 1 - 2
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