DCsunset / pandoc-include

A pandoc filter to allow file and header inclusion

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Included figures with relative paths are not found

massoncl opened this issue · comments

Hi,

I have the following folder structure and files:

.
├── A.rst
├── included 
│   ├── B.rst
│   ├── diagram.jpg

A.rst:

Heading
----------

$include included/B.rst

B.rst:

.. figure:: imageB.png

The figure in B.rst is included via a relative path (relative to B). When B is included into A, this path is included as-is and becomes invalid:

> pandoc  --filter=pandoc-include -f rst -t pdf A.rst
[WARNING] Could not fetch resource diagram.jpg: replacing image with description

For that use case to work, I guess the $include should rewrite the paths to the figures and prepend the path from A to B, so that the relative paths become relative to A. Another option would be to convert them to absolute paths during the include, although I'm not sure how that fits into the overall pandoc-filter philosophy.

Hi, thanks for your suggestions. I also think it is reasonable to rewrite the path in included files. I will work on this later.

I have added this feature in v1.1.0.

Thanks !