liran-funaro / sphinx-markdown-builder

A Sphinx extension to add markdown generation support.
https://pypi.org/project/sphinx-markdown-builder
MIT License
41 stars 19 forks source link

[BUG] Image anchors #22

Open ignapas opened 4 months ago

ignapas commented 4 months ago

Describe the bug

When the HTML builder gives something like

<a class="reference internal image-reference" href="../../_images/SelfInductance_Model.png">
   <img alt="../../_images/SelfInductance_Model.png" src="../../_images/SelfInductance_Model.png" style="width: 70%;" />
</a>

The markdown output only shows

<a id="selfinductancemodel"></a>

No link to the image nor ![]() markdown image code.

To Reproduce

I believe this is the RST code that generates it, although I don't know much about Sphinx template/generation code.

.. _selfinductancemodel:

.. figure:: EMLF_figures/SelfInductance_Model.png
    :align: center
    :width: 70%

    Model for A3 transmit coil.

Expected behavior

I would expect the Markdown builder to give

[![../../_images/SelfInductance_Model.png](../../_images/SelfInductance_Model.png)](../../_images/SelfInductance_Model.png)

or better yet

[<img alt="../../_images/SelfInductance_Model.png" src="../../_images/SelfInductance_Model.png" style="width: 80%;"/>](../../_images/SelfInductance_Model.png)

Environment (please complete the following information):

Additional context

I can provide with any extra info when requested

liran-funaro commented 3 months ago

@ignapas Thank you for the report. I'm sorry it took so much time to reply. Can you elaborate on why we expect a link if the RST only includes an image?

liran-funaro commented 2 months ago

@ignapas The tests already cover figures and it passes. Please see image-target.rst and image-target.md, and see if you can identify what is the difference between this and your case.