Page MenuHomePhabricator

Try to automatically format references with Citoid when they are added to the initial contents in Article Guidance
Closed, ResolvedPublic8 Estimated Story Points

Assigned To
Authored By
Pginer-WMF
May 6 2026, 1:59 PM

Description

As part of the work on Article Guidance (T396029), a new workflow assists users in the process of creating a new article. In that workflow users provide references upfront and those are added as part of the contents under the "References" section when they land into Visual Editor. Currently the references are added just as links. This ticket proposes to improve the formatting of those references to better align with community practices and reduce the risk of articles being deleted.

I started an example article about "Rodrigo Cortés" on Simple English Wikipedia adding two references (a, and b) in the initial steps of the workflow:

simple.wikipedia.org_wiki_Special_NewArticle(Wiki Mobile) (3).png (320×568 px, 52 KB)

When landing into Visual Editor, the references are added at the end in a raw link format. The proposal is to render them better formatted as shown below.

CurrentProposed
simple.wikipedia.org_w_index.php_title=Rodrigo_Cort%C3%A9s&veaction=edit&preload=Wikipedia%3AArticle%20Guidance%2FPerson&preloadparams%5B%5D=%3Cref%20name%3D%22ref1%22%3Ehttps%3A%2F%2Fwww.filmaffinity.com%2Fes%2Fname-awards.php%3Fname-id%3D.png (320×568 px, 49 KB)
simple.wikipedia.org_w_index.php_title=Rodrigo_Cort%C3%A9s&veaction=edit&preload=Wikipedia%3AArticle%20Guidance%2FPerson&preloadparams%5B%5D=%3Cref%20name%3D%22ref1%22%3Ehttps%3A%2F%2Fwww.filmaffinity.com%2Fes%2Fname-awards.php%3Fname-i (3).png (320×568 px, 61 KB)

The proposal is to use Citoid behind the scenes in the same way that the "Add citation" dialog does it in the "Automatic" tab:

simple.wikipedia.org_w_index.php_title=Rodrigo_Cort%C3%A9s&veaction=edit&preload=Wikipedia%3AArticle%20Guidance%2FPerson&preloadparams%5B%5D=%3Cref%20name%3D%22ref1%22%3Ehttps%3A%2F%2Fwww.filmaffinity.com%2Fes%2Fname-awards.php%3Fname-i (1).png (320×568 px, 32 KB)

Event Timeline

Pginer-WMF triaged this task as Medium priority.

As part of this ticket we may want to investigate the processing of templates. An article created in the test instance shows different situations in their content that we may want to avoid:

  • Citations [1], [2], and [3] linking to erroneous references ("invalid <ref>. tag" error.)
  • Initial references provided in the workflow may not have been used, leading to the "cite error" message about references defined in <references> not being used in prior text.

b24e11a4f1.catalyst.wmcloud.org_wiki_Cosmic_Princess_Kaguya!(Wiki Tablet).png (1,024×768 px, 222 KB)

Pginer-WMF raised the priority of this task from Medium to High.May 7 2026, 12:55 PM
eamedina changed the task status from Open to In Progress.May 12 2026, 3:36 AM
eamedina claimed this task.
eamedina moved this task from Prioritized to In-progress on the LPL Hypothesis board.

Change #1286486 had a related patch set uploaded (by Eamedina; author: Eamedina):

[mediawiki/extensions/ArticleGuidance@master] Add references with Citoid formatting

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

Change #1286486 merged by jenkins-bot:

[mediawiki/extensions/ArticleGuidance@master] Add references with Citoid formatting

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

@Pginer-WMF I can see formatting with Citoid is working but I'd like to understand the second issue better. Could you help me with replication instructions since patch demo instance is no longer active?

@Pginer-WMF I can see formatting with Citoid is working but I'd like to understand the second issue better. Could you help me with replication instructions since patch demo instance is no longer active?

The second issue (mentioned in T425549#11898523), covers two different cases.

  • One is about reference "not being used in prior text". That was happening when references are provided in the "sources" step of the Pre-VE workflow, and later the user does not use them when writing the article. So simple reproductio steps could be: provide sources in the Article Guidance process, and publish as soon as you reach the Visual Editor.
  • The other issue ("invalid ref tag") was unexpected and required investigation to learn what caused it. Given the instanc eis gone, we can park it for now and reconsider it again if we find other instances.

Thanks @Pginer-WMF I was able to replicate it.

For context: I think this is a case that does not happen often in the default article creation experience (no guidance), because when you add a reference using the citation button without actually citing it, it disappears. It would only happen in the default experience if you manually added a reference section with references and then didn't use them throughout the text.

This is more likely with Article Guidance since editors add sources upfront and may later forget or choose not to use some of them.

I'm not sure this is something we want to avoid, the warning exists to prompt the editor to either use the source or remove it from the reference section. If they're not using it, deleting it is the right outcome. So I'd lean toward not treating this as a bug to fix. What do you think?

I'm not sure this is something we want to avoid, the warning exists to prompt the editor to either use the source or remove it from the reference section. If they're not using it, deleting it is the right outcome. So I'd lean toward not treating this as a bug to fix. What do you think?

Makes sense, but I still think that the system can do a bit better to handle these situations. The system tells the user to provide references upfront, and at the end of the process, without setting expectations previously, shows a big red message as if the user did something wrong (where the user was basically following the instructions).

So I agree not to consider this a bug, but maybe it is worth it to capture this in a separate ticket for the future. As we observe the use of the feature, we can learn more about (a) how often this happens, (b) how confusing this may be for junior editors (i.e., can they understand what is going on and fix it?) and (c) whether it sends a negative signal to reviewers (i.e., making them more likely to revert these).

@Pginer-WMF I agree with this last points, Pau. I created a separate task for this T431551 and added it to the "guidance while editing" hypothesis milestone so that we can consider when selecting the scope of this hypothesis. Pending to create an epic to group all selected work for guidance while editing. I will close this task as the rest of work was done.