Dear Khang Minh,
On 2015-08-03, Khang Minh wrote:
> I'm trying out the `image` directive,
> http://docutils.sourceforge.net/docs/ref/rst/directives.html#image
> When using it without any options, only the URI argument, the rendered HTML
> does not have any anchor. However, if I specify any option (not `target`)
> there will be an anchor around the generated `img` tag. Is this expected?
It is not expected and I cannot reproduce this behaviour.
When I compile the test file::
.. image:: testimage.jpg
.. image:: testimage2.jpg
:alt: just a test
.. image:: testimage3.jpg
:width: 2 em
:scale: 50 %
.. image:: testimage4.jpg
:width: 200 px
.. image:: testimage5.jpg
:align: right
.. image:: testimage6.jpg
:target: testfile.txt
.. image:: testimage7.jpg
:class: test-style
.. image:: testimage8.jpg
:name: test-image
with Docutils `rst2html` (version Docutils 0.13 [repository], Python
2.7.10, on linux2), I get::
...
<div class="document">
<img alt="testimage.jpg" src="testimage.jpg" />
<img alt="just a test" src="testimage2.jpg" />
<img alt="testimage3.jpg" src="testimage3.jpg" style="width: 1.0em;" />
<img alt="testimage4.jpg" src="testimage4.jpg" style="width: 200px;" />
<img alt="testimage5.jpg" class="align-right" src="testimage5.jpg" />
<a class="reference external image-reference" href="testfile.txt"><img alt="testimage6.jpg" src="testimage6.jpg" /></a>
<img alt="testimage7.jpg" class="test-style" src="testimage7.jpg" />
<img alt="testimage8.jpg" id="test-image" src="testimage8.jpg" />
</div>
...
i.e. only the :target: option triggers wrapping in an anchor.
(The new rst2html5.py front-end results in the same output snippet.)
> Curious if there's any way to disable this behaviour.
What program and version are you using to generate the HTML?
Günter
|