Skip to content

support externally hosted images (v2)#705

Merged
michaeljones merged 1 commit intobreathe-doc:masterfrom
jdknight:support-external-images
Feb 13, 2022
Merged

support externally hosted images (v2)#705
michaeljones merged 1 commit intobreathe-doc:masterfrom
jdknight:support-external-images

Conversation

@jdknight
Copy link
Copy Markdown
Contributor

Observed an issue when attempting to process tinyxml documentation. After generating XML documentation from tinyxml, processing it through breathe would result in the following warning:

sphinx.errors.SphinxWarning: ...\tinyxml.rst::image file not readable: xml/tinyxml/https:/github.com/leethomason/tinyxml2/actions/workflows/test.yml/badge.svg

The project prefix xml/tinyxml/ had been injected into the URI of the image. This commit tries to help mitigate using an absolute path building for external images by checking if the URI defines a URL schema (using implementation from Sphinx's utility class). If a URL schema is detected, assume the source is an external image and just passthrough the value to the generate image node's uri value. Otherwise, default to building a Sphinx project's absolute path to the image.

  • Crudely tested with tinyxml (includes external images) and oglft's documentation (with internal images).
  • Sphinx's url_re call should be available in oldest supported Sphinx revision listed (v2.3.1).

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code Source code enhancement Improvements, additions (also cosmetics)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants