Making WordPress.org

Opened 6 weeks ago

Last modified 6 weeks ago

#5979 new defect

The table of contents is no longer displayed

Reported by: jdy68 Owned by:
Milestone: Priority: normal
Component: HelpHub 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&nbsp;?</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 (7)

This ticket was mentioned in PR #46 on WordPress/wordpress.org by audrasjb.


6 weeks ago

  • Keywords has-patch added

#2 @audrasjb
6 weeks ago

The above PR replace the existing regex to also match headings with attributes.

#3 @dd32
6 weeks 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.

#4 @dd32
6 weeks ago

In 11365:

Support: HelpHub: Attempt to replace the TOC plugin within the HelpHub site with the original WordPress.org-supported TOC plugin it was based on.

The HelpHub plugin was based on the Handbooks plugin, but customised and further plugin-ised, resulting in two different plugins on WordPress.org doing the same thing, in different ways.

This is an attempt to make it easier to sync the Handbook plugin changes to Support pages.

See #5979, #5963.

#5 @dd32
6 weeks ago

In 11366:

Handbooks / HelpHub: Internationalise the Title & Top links, allowing HelpHub to translate it with a different text-domain.

See #5979.

#6 @dd32
6 weeks ago

In 11368:

HelpHub: Avoid a Fatal error with the TOC when both the Handbook and Support plugins are active on a site (For example, Rosetta team sites, which previously had two TOC plugins?)

See #5979.

#7 @dd32
6 weeks 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...

Note: See TracTickets for help on using tickets.