Opened 3 years ago
Closed 3 years ago
#5979 closed defect (bug) (fixed)
The table of contents is no longer displayed
Reported by: | jdy68 | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Component: | HelpHub (wordpress.org/documentation) | Keywords: | has-patch |
Cc: |
Description
I'm co-leader of the French WordPress documentation and I've noticed for a few weeks that when we publish new translated posts, the posts don't offer the table of contents anymore.
For example:
https://fr.wordpress.org/support/article/appearance-customize-screen/ published on October 29, 2021 displays the table of contents but
https://fr.wordpress.org/support/article/theme-base-sur-des-blocs/ published on October 31 no longer displays it.
All posts published after October 31, 2021 no longer show the table of contents.
I observe the same problem for some posts in the English documentation.
For example: https://wordpress.org/support/article/new-to-wordpress-where-to-start/ or https://wordpress.org/support/article/wordpress-features/
Moreover, as soon as you update a post (older) which displayed the table of contents, once the update is done the table of contents is not displayed anymore.
Example: https://fr.wordpress.org/support/article/glossary/ modified today December 6, 2021.
I tried to compare these posts to see what could be a problem, and I don't see anything different in the Hn tags.
Example for h2 and h3 tags:
in https://fr.wordpress.org/support/article/appearance-customize-screen/
<!-- wp:heading -->
<h2 id="basic-use">basic-use</h2>
<!-- /wp:heading -->
<!-- wp:heading {"level":3} -->
<h3 id="how-to-open-the-customization-tool">How to open the customization tool</h3>
<!-- /wp:heading -->
in https://fr.wordpress.org/support/article/theme-base-sur-des-blocs/
<!-- wp:heading -->
<h2 id="what-is-a-block-based-theme">What is a block-based theme ?</h2>
<!-- /wp:heading -->
<!-- wp:heading {"level":3} -->
<h3 id="edit-templates-via-dashboard-templates-screen">Editing templates via the Dashboard Templates screen</h3>
<!-- /wp:heading -->
Finally, the style of the level 3 headings is different depending on whether the post displays a table of contents or not.
If the post doesn’t have a table of contents, the h3 headings are capitalized.
I can provide the source of posts that don’t have a table of contents or search for other information if needed.
With @audrasjb, we think that the problem comes from an incompatibility between WP 5.9 and the extension that creates the table of contents.
Change History (8)
This ticket was mentioned in PR #46 on WordPress/wordpress.org by audrasjb.
3 years ago
#1
- Keywords has-patch added
#3
@
3 years ago
I tackled this slightly different via #5963 - instead of just matching the headings, I respected the settings that Gutenberg can apply to the heading (Including custom ID, classes, styles, etc).
Somewhat annoyingly, these two plugins are the exact same plugin, the one in use here seems to be the code that the Handbook TOC is based on, but wrapped into a bigger plugin.. I think? I can't be too sure.. I can't tell who the original author was.
I'm going to replace the Support HelpHub plugin with the Handbook variant instead, so that we only have to update one plugin.
#7
@
3 years ago
And even more annoyingly, while the Handbooks TOC plugin has some inline CSS, it's not actually the CSS used for styling the TOC listing! That's defined per-theme!
This seems to be working, and makes it much easier to sync changes between them.
I think we're going to need to migrate this TOC plugin to an actual plugin, rather than just a handbook/helphub bundled plugin, as it's also needed for Learn, and potentially other places too.. Or maybe it'd make sense as a published Block instead...
This addresses ticket #5979
https://meta.trac.wordpress.org/ticket/5979
The new regex was tested here: http://sandbox.onlinephpfunctions.com/code/ff48352bda8f2ec3500856b6c18a0b3f4ffeeb9e