You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
HTML image alt text is reparsed as directive option syntax #1213
5.1.0, reproduced from current master at 723cffcf84213f0cb58695b27eec9ad72052b53a.
What version dependencies are you using?
Python 3.11.16 on macOS. The regression was exercised with Sphinx 9.0.4 / docutils 0.22.4 and Sphinx 8.2.3 / docutils 0.21.2; markdown-it-py 4.2.0 and mdit-py-plugins 0.6.1.
Describe the bug
With html_image enabled, decoded HTML image attributes are serialized into directive option text and parsed again. Valid literal alt text can therefore be truncated or dropped and produce warnings:
A # sign becomes A, with a directive-comments warning.
"quoted" text loses its alt attribute, with an invalid-options-format warning.
First followed by a newline and second becomes First, with a forbidden-content warning.
This loses accessibility text and can fail warning-strict builds.
Preserve the decoded alt value exactly, without interpreting it as directive option syntax. The same problem occurs for inline HTML images.
This differs from #1210 and #1211, which concern Markdown image text_special tokens in renderInlineAsText. This reproduction starts with an HTML <img> tag and fails during HTML-to-directive conversion.
This report and the accompanying patch were prepared with AI assistance.
Activity