mastodon / documentation

Mastodon documentation
https://docs.joinmastodon.org
GNU Free Documentation License v1.3
1.7k stars 973 forks source link

`HAHAHUGOSHORTCODE-s0-HBHB` on https://docs.joinmastodon.org/entities/DomainBlock #1487

Closed nikclayton closed 2 months ago

nikclayton commented 2 months ago

https://docs.joinmastodon.org/entities/DomainBlock (and possibly other pages) is displaying HAHAHUGOSHORTCODE-s0-HBHB.

Apparently this is an issue with Hugo shortcodes, but I'm not familiar enough with Hugo to debug further.

ClearlyClaire commented 2 months ago

This seems related to https://github.com/gohugoio/hugo/issues/7416

aaaaalbert commented 2 months ago

The {{<optional>}} Hugo shortcode appears in three files (per code search: DomainBlock, Instance, and ScheduledStatus).

AFAICS, the difference is that for DomainBlock, the shortcode is part of a ###-level heading and is included in the Table of Contents at the top of the page, whereas it is on level #### or ##### or not even part of a heading in the other files (and thus not pulled into the ToC).

According to the linked Hugo issue, the problematic instance should be modified to {{%optional%}}.

I can provide a PR, but I don't have the toolchain at hand so I cannot test the change.

aaaaalbert commented 2 months ago

Here you go.

Let me emphasize once more: I have not tested that patch!

I have tested the patch in the meantime, and it works. See PR for details.

aaaaalbert commented 2 months ago

(Afterthought: the build process for the docs website should probably grep the Hugo-built files for HAHAHUGOSHORTCODE and complain.)

aaaaalbert commented 2 months ago

For reference, the Hugo docs explain the different shortcodes.

My summary: {{< shortcodes are not rendered before being sent to the content renderer (causing the HAHAHUGOSHORTCODE issue) whereas {{% shortcode are – for the latter type, which the above PR puts into use, "[t]his means that the rendered output from a shortcode can be part of the page’s table of contents [...]"