From 79eae5eea6e80e51bf866cb4860bf3ce916c196e Mon Sep 17 00:00:00 2001 From: Megh Parikh Date: Wed, 15 May 2024 20:26:11 -0400 Subject: [PATCH 1/7] Call embed_images when including a file Fixes issues where the image was not linked correctly --- pdoc/docstrings.py | 1 + 1 file changed, 1 insertion(+) 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" From 3ed7269ae2515c20e1c397aa8b1ce89060237415 Mon Sep 17 00:00:00 2001 From: Megh Parikh Date: Wed, 15 May 2024 20:40:33 -0400 Subject: [PATCH 2/7] Add test include image --- test/testdata/flavors_rst_include/include.rst | 2 ++ test/testdata/flavors_rst_include/test-include-pdoc-logo.svg | 1 + 2 files changed, 3 insertions(+) create mode 120000 test/testdata/flavors_rst_include/test-include-pdoc-logo.svg diff --git a/test/testdata/flavors_rst_include/include.rst b/test/testdata/flavors_rst_include/include.rst index 26e31db6..50bce48e 100644 --- a/test/testdata/flavors_rst_include/include.rst +++ b/test/testdata/flavors_rst_include/include.rst @@ -1,3 +1,5 @@ Hello +![pdoc logo](./test-include-pdoc-logo.svg) + .. include:: subinclude.rst diff --git a/test/testdata/flavors_rst_include/test-include-pdoc-logo.svg b/test/testdata/flavors_rst_include/test-include-pdoc-logo.svg new file mode 120000 index 00000000..43544d0e --- /dev/null +++ b/test/testdata/flavors_rst_include/test-include-pdoc-logo.svg @@ -0,0 +1 @@ +../../../pdoc/templates/resources/pdoc-logo.svg \ No newline at end of file From 609a74dd962ec1093d1d3ac87630064191f99933 Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Thu, 16 May 2024 00:41:27 +0000 Subject: [PATCH 3/7] [autofix.ci] apply automated fixes --- test/testdata/flavors_rst.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/testdata/flavors_rst.html b/test/testdata/flavors_rst.html index e16e34bb..e6bb328e 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 \)

From 8af698433108cb8af37d629048e5664af2aa6611 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Thu, 16 May 2024 02:44:24 +0200 Subject: [PATCH 4/7] nits --- CHANGELOG.md | 1 + test/testdata/flavors_rst_include/include.rst | 2 +- test/testdata/flavors_rst_include/test-include-pdoc-logo.svg | 1 - 3 files changed, 2 insertions(+), 2 deletions(-) delete mode 120000 test/testdata/flavors_rst_include/test-include-pdoc-logo.svg diff --git a/CHANGELOG.md b/CHANGELOG.md index b86b140b..70466c88 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ## Unreleased: pdoc next +- Fix image embedding in included rST files. - 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/test/testdata/flavors_rst_include/include.rst b/test/testdata/flavors_rst_include/include.rst index 50bce48e..f2326276 100644 --- a/test/testdata/flavors_rst_include/include.rst +++ b/test/testdata/flavors_rst_include/include.rst @@ -1,5 +1,5 @@ Hello -![pdoc logo](./test-include-pdoc-logo.svg) +![pdoc logo](../../../pdoc/templates/resources/pdoc-logo.svg) .. include:: subinclude.rst diff --git a/test/testdata/flavors_rst_include/test-include-pdoc-logo.svg b/test/testdata/flavors_rst_include/test-include-pdoc-logo.svg deleted file mode 120000 index 43544d0e..00000000 --- a/test/testdata/flavors_rst_include/test-include-pdoc-logo.svg +++ /dev/null @@ -1 +0,0 @@ -../../../pdoc/templates/resources/pdoc-logo.svg \ No newline at end of file From 09e9bf0ed059b266f04da2777d2d62d88113d52b Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Thu, 16 May 2024 00:45:19 +0000 Subject: [PATCH 5/7] [autofix.ci] apply automated fixes --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 70466c88..ec1fd07c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ## 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 From c9d4a7bfea405b641a0ee9793b387d60dfb6b297 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Thu, 16 May 2024 03:08:50 +0200 Subject: [PATCH 6/7] use png logo --- test/testdata/flavors_rst_include/include.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/testdata/flavors_rst_include/include.rst b/test/testdata/flavors_rst_include/include.rst index f2326276..7e4c0977 100644 --- a/test/testdata/flavors_rst_include/include.rst +++ b/test/testdata/flavors_rst_include/include.rst @@ -1,5 +1,5 @@ Hello -![pdoc logo](../../../pdoc/templates/resources/pdoc-logo.svg) +![pdoc logo](../../../docs/logo.png) .. include:: subinclude.rst From 8fb780317fe523f95d7ffde755c47ca3991fc99b Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Thu, 16 May 2024 01:09:36 +0000 Subject: [PATCH 7/7] [autofix.ci] apply automated fixes --- test/testdata/flavors_rst.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/testdata/flavors_rst.html b/test/testdata/flavors_rst.html index e6bb328e..58fa07f2 100644 --- a/test/testdata/flavors_rst.html +++ b/test/testdata/flavors_rst.html @@ -714,7 +714,7 @@
This warning has a title only.

Hello

-

pdoc logo

+

pdoc logo

World!