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:
@@ -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)
|
||||
|
@@ -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)
|
||||
|
||||
|
Reference in New Issue
Block a user