-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Labels
status: acceptedThis issue has been accepted for implementationThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the applicationA confirmed report of unexpected behavior in the application
Description
NetBox version
v3.1.9
Python version
3.10
Steps to Reproduce
- Run NetBox shell and import the
render_markdowntemplatetag:
$ /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py nbshell
### NetBox interactive shell (ubuntuserver)
### Python 3.10.2+ | Django 3.2.12 | NetBox 3.1.9
### lsmodels() will show available models. Use help(<model>) for more info.
>>> from utilities.templatetags.helpers import render_markdown
- Try to render test case URLs:
>>> render_markdown('[TEST](/dcim/devices/1/)')
'<div class="rendered-markdown"><p><a href="/dcim/devices/1/">TEST</a></p></div>' # Correct
>>> render_markdown('[TEST:](/dcim/devices/1/)')
'<div class="rendered-markdown"><p><a href="/dcim/devices/1/">TEST:</a></p></div>' # Correct
>>> render_markdown('[TEST](/dcim/devices/1/) [TEST](/dcim/devices/1/)')
'<div class="rendered-markdown"><p><a href="/dcim/devices/1/">TEST</a> <a href="/dcim/devices/1/">TEST</a></p></div>' # Correct
>>> render_markdown('[TEST](/dcim/devices/1/) [TEST:](/dcim/devices/1/)')
'<div class="rendered-markdown"><p>[TEST](](/dcim/devices/1/)</p></div>' # Incorrect
>>> render_markdown('[TEST](https://netbox.site/dcim/devices/1/) [TEST:](https://netbox.site/dcim/devices/1/)')
'<div class="rendered-markdown"><p><a href="https://netbox.site/dcim/devices/1/">TEST</a> <a href="https://netbox.site/dcim/devices/1/">TEST:</a></p></div>' # CorrectExpected Behavior
The string
[TEST](/dcim/devices/1/) [TEST:](/dcim/devices/1/)
should be rendered as
<div class="rendered-markdown"><p><a href="/dcim/devices/1/">TEST</a> <a href="/dcim/devices/1/">TEST:</a></p></div>
Observed Behavior
The string
[TEST](/dcim/devices/1/) [TEST:](/dcim/devices/1/)
was rendered as
<div class="rendered-markdown"><p>[TEST](](/dcim/devices/1/)</p></div>
Metadata
Metadata
Assignees
Labels
status: acceptedThis issue has been accepted for implementationThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the applicationA confirmed report of unexpected behavior in the application