matrix-org / matrix-spec

The Matrix protocol specification
Apache License 2.0
188 stars 94 forks source link

Fix the table of content for room versions #1884

Closed zecakeh closed 3 months ago

zecakeh commented 3 months ago

We need to use .RenderShortcodes for room version pages like in #1851, otherwise the headings in the included fragments are not present in the ToC of the page.

However, that breaks the withVersioning trick, because the output we get has shortcodes replaced by temporary opaque strings, so we cannot detect them to remove them. The solution I found is to use a page parameter in the added-in and changed-in shortcodes to detect if the current version is the same as the v parameter, since it seems to be the only way to pass a variable from the rendered page to the shortcode in the fragment.

Pull Request Checklist

Preview: https://pr1884--matrix-spec-previews.netlify.app

turt2live commented 3 months ago

https://spec.matrix.org/unstable/rooms/v11/ (and others) appear to be working fine right now. Is there a place where we can see the bug?

zecakeh commented 3 months ago

It doesn't work fine, there are entries missing in the toc.

Example for v11:

Before this PR:

image

After this PR (notice the new entries under "State Resolution"):

image

turt2live commented 3 months ago

oh my. That's dangerous.

Ideally we'd have CI for this, but that's not a problem for this PR to solve.