Page MenuHomePhabricator

Add links to template styles, modules and interface calls
Closed, ResolvedPublicFeature

Description

Feature summary:
I love the links to templates in the new CodeMirror editor! (T259059)
Please add similar links to other elements.

Use case(s):

  • Editing a template or an advanced article could benefit from a link to CSS for wikitext: <templatestyles src="Piechart/style.css"/> (should add a "Template:" prefix if a prefix is missing).
  • Editing a template that calls a Lua module: {{#invoke:Piechart|parseMetaParams}}
  • Editing a message like e.g. [[MediaWiki:Globalblocking-blockedtext-user]] could use a quick link for {{int:wikimedia-globalblocking-blockedtext-appeal-user}} or {{int:blockedtext-expiration-time|$6}}.

Benefits:
This would help all advanced editors. While the last feature might be sysop-only, sysops are important too :)

Current links in the editor are underlined (in this example {{int:...}} could have a link):

obraz.png (815×233 px, 23 KB)

Event Timeline

Nux renamed this task from Add links to template styles, modules and to Add links to template styles, modules and interface calls.Mar 25 2025, 1:24 AM
Bhsd moved this task from Backlog to Feature requests on the MediaWiki-extensions-CodeMirror board.
Bhsd subscribed.

<templatestyles> and {{#invoke:}} are provided by extensions. Should we incorporate the special treatment in their respective extensions or in the CodeMirror extension?

Change #1134551 had a related patch set uploaded (by Bhsd; author: Bhsd):

[mediawiki/extensions/CodeMirror@master] openLinksExtension: support <templatestyles>

https://gerrit.wikimedia.org/r/1134551

Sorry for taking so long to reply! (I'm gonna get better at this, I promise)

Just +2'd the patch. Normally the answer is yes, extension-related things should go in that extension, not CodeMirror. But here the cost is quite small and presumably we need knowledge of these tags inside the stream parser.

Something to think about moving forward, is how we might allow integrations to add custom functionality to our stream parser. Something like that might be needed for T357480: Add a means for mixed languages in wikitext in CodeMirror 6. Similar to before, I envision allowing for injecting RL modules via an extension attribute. We'd need to load those modules in our stream parser, and give it whatever context it needs to make the intended changes to the parser. Maybe we can brainstorm this more at the Hackathon next week :)

Change #1134551 merged by jenkins-bot:

[mediawiki/extensions/CodeMirror@master] openLinksExtension: support <templatestyles>

https://gerrit.wikimedia.org/r/1134551

Change #1139777 had a related patch set uploaded (by Bhsd; author: Bhsd):

[mediawiki/extensions/CodeMirror@master] openLinksExtension: support selected parser functions

https://gerrit.wikimedia.org/r/1139777

Change #1139777 merged by jenkins-bot:

[mediawiki/extensions/CodeMirror@master] openLinksExtension: support selected parser functions

https://gerrit.wikimedia.org/r/1139777

Bhsd moved this task from Feature requests to Done on the MediaWiki-extensions-CodeMirror board.