diff --git a/CHANGELOG.md b/CHANGELOG.md index b86b140b..ec1fd07c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ ## Unreleased: pdoc next +- Fix image embedding in included rST files. + ([#692](https://github.com/mitmproxy/pdoc/pull/692), @meghprkh) - Support type-hints from stub-only packages. E.g: `scipy-stubs` ([#671](https://github.com/mitmproxy/pdoc/pull/671), @erikdesmedt) - Modify css styles for MathJax to remove unnessesary scroll bars diff --git a/pdoc/docstrings.py b/pdoc/docstrings.py index db604bb6..33320fb5 100644 --- a/pdoc/docstrings.py +++ b/pdoc/docstrings.py @@ -380,6 +380,7 @@ def _rst_admonition(m: re.Match[str]) -> str: warnings.warn(f"Cannot include {val!r}: {e}") included = "\n" included = _rst_admonitions(included, loc.parent / val) + included = embed_images(included, loc.parent / val) return indent(included, ind) if type == "math": return f"{ind}$${val}{contents}$$\n" diff --git a/test/testdata/flavors_rst.html b/test/testdata/flavors_rst.html index e16e34bb..58fa07f2 100644 --- a/test/testdata/flavors_rst.html +++ b/test/testdata/flavors_rst.html @@ -714,6 +714,8 @@
This warning has a title only.

Hello

+

pdoc logo

+

World!

\( 42 \)

diff --git a/test/testdata/flavors_rst_include/include.rst b/test/testdata/flavors_rst_include/include.rst index 26e31db6..7e4c0977 100644 --- a/test/testdata/flavors_rst_include/include.rst +++ b/test/testdata/flavors_rst_include/include.rst @@ -1,3 +1,5 @@ Hello +![pdoc logo](../../../docs/logo.png) + .. include:: subinclude.rst