Closed Bug 1061226 Opened 10 years ago Closed 9 years ago

markdown isn't linkifying urls

Categories

(Bugzilla :: Bugzilla-General, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 6.0

People

(Reporter: glob, Assigned: altlist)

References

Details

(Keywords: regression)

Attachments

(1 file, 3 obsolete files)

markdown isn't linkifying all urls.

eg.

http://www.example.com
foo@example.com

currently http://www.example.com isn't converted to a link when markdown is enabled, however it is when markdown is disabled.
Depends on: 330707
Keywords: regression
That's because according to Markdown specification and its original implementation, you need to surround URLs with angle brackets. [1] But, that should be linkified anyway. Also, if we follow Markdown standards, we need to decide whether to omit angle brackets after linkifiying or leave them unchanged. Bugzilla does not remove them but standard Markdown does.

[1]: http://daringfireball.net/projects/markdown/syntax#autolink
Attached patch patch-v1.0 (obsolete) — Splinter Review
This might be a nasty hack!
Attachment #8488277 - Flags: review?(glob)
Comment on attachment 8488277 [details] [diff] [review]
patch-v1.0

Review of attachment 8488277 [details] [diff] [review]:
-----------------------------------------------------------------

this needs to operate the same as quoteUrls (ie. honour SAFE_PROTOCOLS).
Attachment #8488277 - Flags: review?(glob) → review-
Attached patch patch-v2 (obsolete) — Splinter Review
Assignee: general → koosha.khajeh
Attachment #8488277 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #8488990 - Flags: review?(glob)
Attachment #8488990 - Flags: review?(glob)
Attachment #8488990 - Attachment is obsolete: true
Whiteboard: [roadmap: 5.0]
Attached patch patch-v2 (obsolete) — Splinter Review
Attachment #8490826 - Flags: review?(glob)
Comment on attachment 8490826 [details] [diff] [review]
patch-v2

Review of attachment 8490826 [details] [diff] [review]:
-----------------------------------------------------------------

this is much better, however it doesn't cope well with links within quotes.

> "http://example.com"
comes out as
> "http://example.com&quot

the comment for _DoAutoLinks will also need updating.
Attachment #8490826 - Flags: review?(glob) → review-
Hi Koosha. Just looking at some of the remaining unresolved issues that is blocking us from branching for 5.0. This bug is one and was wondering if you will be able to take a look at this soon. I don't mind taking it if you are not going to be able able to. 

Thanks
dkl
Flags: needinfo?(koosha.khajeh)
(In reply to David Lawrence [:dkl] from comment #7)
> Hi Koosha. Just looking at some of the remaining unresolved issues that is
> blocking us from branching for 5.0. This bug is one and was wondering if you
> will be able to take a look at this soon. I don't mind taking it if you are
> not going to be able able to. 
> 
> Thanks
> dkl

OK, you can take it. But, take care not to double-linkify link definitions in reference-style links while you patch this bug.
Assignee: koosha.khajeh → general
Status: ASSIGNED → NEW
Flags: needinfo?(koosha.khajeh)
Severity: normal → blocker
Severity: blocker → normal
Flags: blocking5.0?
Flags: blocking5.0? → blocking5.0+
Flags: blocking5.0+ → blocking5.0-
Target Milestone: Bugzilla 5.0 → Bugzilla 6.0
Attached patch alternative v1Splinter Review
Attached is an alternative solution where I handle it in DoAnchors.

The only situation this patch is not able to handle is something like below, where a ';' appears just before the url.  This is because I need to do a negative lookbehind to ignore both &lt; and ['"<>].  Perhaps somebody can take this further.  

  ;http://mozilla.org
Attachment #8579747 - Flags: review?(dkl)
Comment on attachment 8579747 [details] [diff] [review]
alternative v1

Review of attachment 8579747 [details] [diff] [review]:
-----------------------------------------------------------------

r=dkl

::: Bugzilla/Markdown.pm~
@@ +258,5 @@
>  
> +    # Last, handle "naked" references
> +    # Caveat, does not handle ;http://amazon.com
> +    $text =~ s{
> +        (                    

remove whitespace
Attachment #8579747 - Flags: review?(dkl) → review+
Flags: approval?
Attachment #8490826 - Attachment is obsolete: true
Assignee: general → altlist
Flags: approval? → approval+
To ssh://gitolite3@git.mozilla.org/bugzilla/bugzilla.git
   1fbcede..1fa1aa5  master -> master
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: