Skip to main content

pandoc-img-glob is a panflute pandoc filter.

In multi file and GitHub stored markdown projects, many images are specified relative to their documents. For example consider the following document tree:

example
|-- section1
|   |-- image1.png
|   `-- section1.md
|-- section2
|   |-- images
|   |   |-- image3.png
|   |   `-- image2.png
|   `-- section2.md
`-- Makefile

Assuming the Makefile would compile my full book, it might look like this:

book:
    pandoc -o book.pdf section*/*.md

And in section1.md there would be a line referencing image1.png, etc. This is often used because then the GitHub preview looks awesome! However, pandoc has no way of telling where files came from, so it loses track of image references, resulting in errors like this:

[pandoc warning] Could not find image `image1.png', skipping...
[pandoc warning] Could not find image `images/image2.png', skipping...
[pandoc warning] Could not find image `images/image3.png', skipping...

pandoc-img-glob solves this problem by just searching recursivly through the path find images matching the given filenames and providing pandoc (and pandoc only) with the absolute paths. This allows for both: Beautiful pdfs and GitHub previews using the updated Makefile.

fixedbook:
    pandoc --filter pandoc-img-glob -o book.pdf section*/*.md

However, this filter becomes slow if you have very deep and complex file trees, and if you have multiple images with the same name, it will just silently use the first it finds.

Installation

Just use pip to install it from pypi

pip install pandoc-img-glob

Metadata

Release files for pandoc-img-glob 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pandoc-img-glob 0.1.1
File Size Uploaded
pandoc-img-glob-0.1.1.tar.gz 3.6 kB Details

Release files / pandoc-img-glob-0.1.1.tar.gz

Download URL pandoc-img-glob-0.1.1.tar.gz
Size 3.6 kB
Tags Source
SHA-256 checksum
How to use checksums
dac78f442a3a23d240fae6844efdebf7ce90ce56501570fcefd8a67fad292003
BLAKE2b-256 checksum
How to use checksums
7b75d5064c96fcefae69172afd2fd350134ea3f6f3aeff76fd569018fdc5b3e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

0.1.3

1 release file

This release

0.1.1 This release

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page