Opened 3 years ago

Closed 3 years ago

#18662 closed Bug (invalid)

Urlize fails with Markdown url string

Reported by: anon Owned by: nobody
Component: Template system Version: 1.4
Severity: Normal Keywords:
Cc: pelletier Triage Stage: Design decision needed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Following template tag fails with "Invalid IPv6 URL":

{{ "Text [Dr. Bunsen (Seth Brown)](http://drbunsen.org) more text"|urlize }}

Change History (4)

comment:1 Changed 3 years ago by d1ffuz0r

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

You really want it? Markdown himself makes link, or try it

>>> Template("""Text [Dr. Bunsen (Seth Brown)]({{ "http://drbunsen.org"|urlize }}) more text""").render(c)
u'Text [Dr. Bunsen (Seth Brown)](<a href="http://drbunsen.org" rel="nofollow">http://drbunsen.org</a>) more text'
Last edited 3 years ago by d1ffuz0r (previous) (diff)

comment:2 Changed 3 years ago by pelletier

  • Triage Stage changed from Unreviewed to Design decision needed

According to the documentation the urlize filter is not meant to handle markdown formatting. In fact, it only supports plain URLs and a very simple syntax (text of your link http://yourlink).

Unsurprisingly, when you use it on some markdown, the matching won't work as expected. Here, the URL Django finds is http://Brown)](http://drbunsen.org, which is why it eventually fails.

In my opinion it's a wontfix: I think Django does not have to implement markdown-specific functions, and as d1ffuz0r pointed out, you have a way to achieve your (apparent) goal. However, I set it as a DDN because some people may think otherwise.

comment:3 Changed 3 years ago by pelletier

  • Cc pelletier added

comment:4 Changed 3 years ago by claudep

  • Resolution set to invalid
  • Status changed from new to closed

Same opinion here. Markdown syntax should be passed to the "|markdown" filter.

Note: See TracTickets for help on using tickets.
Back to Top