Board Thread:New Features/@comment-1526346-20160904055140/@comment-24473195-20160905160615

Kirkburn wrote: For example, some categories can come via templates and thus aren't even in the code of the article you're viewing.

That said, it is something I hope we can look at improving in the future! Indeed, I've looked into this quite a bit (a long time ago) for sweeper or masscat, and can say with utmost confidence that it is currently technically impossible  to properly detect and remove all types of categories from a page. Aside from crazy stuff like, that works (if I recall correctly) :

--Template:Catpart1 Categ --Template:Catpart2 ory:Abc ory:bugabugabuga]]

Lua and wikitext can also generate categories randomly by using parser functions or date functions.

The only robust alternative is completely separating category metadata from the article, and / or creating new tool / markup that forces a rigid structure for categories.

Actually, I just thought of a simple alternative. Rather than digging through a template and removing all the [[Category:]] markup, one could introduce a parser function or magic word that suppresses the category. That way if it doesn't detect the "standard" markup, all it would need to do is add something like:

{{#removecat|CatA|CatB|CatC|...]]

It is an imperfect solution, and one that I would personally avoid.