Skip to content

Table of contents: Avoid parsing the document using libxml in PHP #29560

@aristath

Description

@aristath

What problem does this address?

Right now the TOC block parses the content of the post on render, dynamically generating the list every time.
It works, but is a resources-intensive process and could be optimized.

What is your proposed solution?

Instead of building the TOC dynamically on render, we could do it via JS in the editor itself. This way it will be saved as a list and rendered a lot faster and efficiently.
The headings structure can be saved in the block attributes and updated on the fly as the post gets edited.
This would mean that the classic block will be ignored by the TOC block, but that is to be expected and in fact something we may want to enforce since users should be using the heading blocks to structure their content, and classic blocks can be converted to block-based content.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions