To match the stock HTML output, images that are marked with ``html`` target are
used. If image name is present, the image is rendered as a figure with caption.
+It's possible affect width/height of the image using the ``sizespec`` parameter
+(unlike stock Doxygen, which makes use of this field only for LaTeX output and
+ignores it for HTML output). The parameter is converted to an inline CSS
+:css:`width` or :css:`height` property, so the value has to contain the units
+as well:
+
+.. code:: c++
+
+ /**
+ @image image.png width=250px
+ */
`Pages, sections and table of contents`_
----------------------------------------
else:
logging.warning("{}: image {} was not found in XML_OUTPUT".format(state.current, name))
+ sizespec = ''
+ if 'width' in i.attrib:
+ sizespec = ' style="width: {}"'.format(i.attrib['width'])
+ elif 'height' in i.attrib:
+ sizespec = ' style="height: {}"'.format(i.attrib['height'])
+
caption = i.text
if caption:
- out.parsed += '<figure class="m-figure{}"><img src="{}" alt="Image" /><figcaption>{}</figcaption></figure>'.format(
+ out.parsed += '<figure class="m-figure{}"><img src="{}" alt="Image"{} /><figcaption>{}</figcaption></figure>'.format(
' ' + add_css_class if add_css_class else '',
- name, html.escape(caption))
+ name, sizespec, html.escape(caption))
else:
- out.parsed += '<img class="m-image{}" src="{}" alt="Image" />'.format(
- ' ' + add_css_class if add_css_class else '', name)
+ out.parsed += '<img class="m-image{}" src="{}" alt="Image"{} />'.format(
+ ' ' + add_css_class if add_css_class else '', name, sizespec)
elif i.tag == 'hruler':
assert element.tag == 'para' # is inside a paragraph :/
<h1>
My Project
</h1>
-<p>Image:</p><img class="m-image" src="tiny.png" alt="Image" /><p>Figure:</p><figure class="m-figure"><img src="tiny.png" alt="Image" /><figcaption>Caption</figcaption></figure>
+<p>Image:</p><img class="m-image" src="tiny.png" alt="Image" /><p>Figure:</p><figure class="m-figure"><img src="tiny.png" alt="Image" /><figcaption>Caption</figcaption></figure><p>Explicit width:</p><img class="m-image" src="tiny.png" alt="Image" style="width: 128px" /><p>Explicit height and a caption:</p><figure class="m-figure"><img src="tiny.png" alt="Image" style="height: 64px" /><figcaption>This is 64 pixels high.</figcaption></figure>
</div>
</div>
</div>
@image html tiny.png Caption
+Explicit width:
+
+@image html tiny.png width=128px
+
+Explicit height and a caption:
+
+@image html tiny.png "This is 64 pixels high." height=64px
+
*/
/** @page warnings Images that produce warnings