Skip empty wikilink `[[]]` and reverse pipe trick `[[|foo]]` where valid
and correct title cannot be generated respectively.
Bug: T368166
Change-Id: I5df409c8aa104d93a62cd5c0dbd671d598b7c79e
* Use wikipage.content hook event so that links are also applied on
content added through JS tools like live preview, real time preview,
DiscussionTools, etc. (Consider checking the diff with whitespaces
ignored.)
* Preserve fragments (anchors) in links by using mw.Title getUrl().
Bug: T368166
Change-Id: Ib3a4d03abf7401c39bc3261ca2056cce482edb13
Prepend '//' to relative URLs to turn them to real new (root)
addresses instead of relative paths in current domain
Bug: T368166
Follow-up: I999937c1f6303ecc64adb6285e73a9ce10f67bd8
Change-Id: I2cf901c7b0454517dc93ea8113dcf69832584c08
* Use mw.Title so that template links work for templates outside
template namespace, and so that titles are normalized.
* Use recursion instead of while loop so that both the segments before
and after the inserted link are searched for further linking
possibilities. Among other cases, this fixes the case where a template
link before a wikilink (on the same line) was not working. This also
avoids infinite iteration if mw.Title.newFromText() failed to create a
valid Title object.
Bug: T368166
Bug: T374693
Change-Id: I4d485340928b81df26ca035874422fdb5930710f
It's common practise to use [[wikilink]] syntax to mention page names
in comments of JS/CSS/Scribunto code where the links ordinarily don't
work. Using JavaScript to actually make the syntax clickable makes
navigation easier.
{{Templates links}} and external links are also supported.
Bug: T368166
Change-Id: I999937c1f6303ecc64adb6285e73a9ce10f67bd8