Skip to content

GitLab backend produces unrenderable lazy-loaded <img> tags #27

Description

@nickhaddady

Note: This bug was discovered by me, but claude wrote this bug report and helped create a simple example to reproduce the issue.

When using the gitlab backend images render blank in the MATLAB Help Browser (and in any plain browser opening the generated HTML).

When DOCMAKER_CONVERTER=GitLab, docconvert emits tags with data-src and class="lazy" plus a 1×1 GIF placeholder in src. The real image path lives in data-src and is only swapped into src by GitLab's web-UI lazy-load JavaScript, which DocMaker does not ship.

Environment

  • DocMaker 0.7
  • MATLAB R2026a
  • DOCMAKER_CONVERTER=GitLab against an internal GitLab instance (/api/v4/markdown)

Reproduction
Minimal repro attached (docmakerimagebug.zip): a single markdown file with one image, a buildfile, and the PNG.

docmakerimagebug/
├── buildfile.m
└── doc/
├── image_test.md
├── helptoc.md
└── images/test_image.png
.

  1. Ensure the GitLab backend is selected:

    setpref("docmaker", "converter", "GitLab")
    OR
    setenv("DOCMAKER_CONVERTER", "GitLab")),

and configure DOCMAKER_GITLAB_HOSTNAME / DOCMAKER_GITLAB_TOKEN.

  1. From the repro folder, run buildtool doc.
  2. Open doc/image_test.html in a browser, or via doc in MATLAB after the build.

Expected

<img alt="Cluster State" src="images/test_image.png"/>

(matches what the GitHub backend backend produces)

Actual

<img alt="Cluster State" class="lazy" data-src="images/test_image.png"
decoding="async" src="data:image/gif;base64,R0lGODlh...placeholder..."/>

The image area is blank — src resolves to the placeholder GIF and no JS runs to swap in data-src.

Root cause
The GitLab Markdown API (/api/v4/markdown) returns HTML pre-decorated for GitLab's web UI, which ships a lazysizes-style bundle that performs the data-src → src swap on page load. DocMaker embeds the API response verbatim, but the rendering context (Help Browser / standalone HTML) has no such JS. The GitHub backend is unaffected because api.github.com/markdown/raw returns plain .

Suggested fix (from Claude, and completely not validated or thought through)

In +docmaker/GitLab.m, post-process the API response to undo the lazy-load decoration before returning the DOM:

  • replace data-src= with src=
  • remove class="lazy" and decoding="async"
  • strip the placeholder src="data:image/gif;base64,..." that precedes data-src

Workaround

Use the GitHub backend and produces clean output.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions