Page MenuHomePhabricator

Allow manipulation of Table Of Content's class and id
Closed, DuplicatePublic

Description

Mediawiki's TOC has a default toc class and id as "toc". In certain circumstances, it might be needed to manipulate this class and id by extensions to style the toc completely independent of the skin's styles.
An example use case can be the toc present here - https://en.wikivoyage.org/wiki/Canada
A feature could be added in core, to expose methods to set toc's id and class which would replace the default "toc".

Event Timeline

Sumit raised the priority of this task from to Needs Triage.
Sumit updated the task description. (Show Details)
Sumit added a project: MediaWiki-General.
Sumit added subscribers: Sumit, Jdlrobson.

Isn't it possible for you to use core's "toc" class/id?

When using the default "toc" class or id for custom styling, often the existing styles on toc added by skin override, especially if one adds style by using $out->addModuleStyles().
For example, vector sets a non-zero margin on list elements of toc which take precedence even if one sets their margin to zero( in an extension ). I'll put up an example shortly.

Aklapper triaged this task as Lowest priority.Jul 15 2015, 11:22 PM
Ricordisamoa set Security to None.
Ricordisamoa subscribed.

Change 884102 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[mediawiki/core@master] Provide ability to customize the TOC title, id, and class

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

Change #884102 merged by jenkins-bot:

[mediawiki/core@master] Provide ability to customize the TOC title, id, and class

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