Skip to content

Support AsciiDoc image block formatting

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Release notes

Support AsciiDoc image block formatting

Problem to solve

The AsciidocSanitizationFilter still sanitizes image macros, resulting in poorly rendered formatting.

For example, this snippet has an image block with syntax

.Example image block 
image::https://upload.wikimedia.org/wikipedia/commons/3/35/Tux.svg[Tux,height=300,role=thumb]

for an image with a framing role to give the image and its caption a border to separate it from the rest of the text. In the screenshot below, Gitlab (left) sanitizes the Asciidoc classes for this formatting and is missing CSS for styling the content. The Asciidoctor gem (right) correctly displays the image with border formatting and caption CSS.

Gitlab image macro rendering

Proposal

The asciidoctor gem uses several classes for image macros in its HTML implementation: div.imageblock, div.content, div.title. From the image macro reference, image macros can have additional classes depending on its Asciidoc attributes such as the roles left, right, thumb, related, rel.

These classes should be added to the allow-lists AsciidocSanitizationFilter and may require additional styling in typography.scss.

Intended users

Me Unknown/TBD.

Metrics


Related to gitlab-foss#63298 (closed) and &1378 (closed)

Edited by 🤖 GitLab Bot 🤖