-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
doc: use imgconverter with imagemagick #455
base: main
Are you sure you want to change the base?
Conversation
…}/doc/source/conf.py: extensions: add: "sphinx.ext.imgconverter"
…}/.github/workflows/ci_cd.yml: doc-build: dependencies: "imagemagick"
…DME.rst: add: Install imagemagick for image conversion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Letting final approval to @jorgepiloto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! Thanks @anscfrisson 🚀
To ensure smoother operations, we implement the following code snippet in some of our libraries:
This adjustment helps us avoid the necessity of installing ImageMagick. It's worth noting that due to differences in supported image types for HTML and PDF in Sphinx, SVG images occasionally cause issues. i hope perhaps this could be helpful for libraries that prefer not to install ImageMagick. |
@Revathyvenugopal162 Thanks for this solution that potentially brings less external requirements! Could you please share the link to a repository where this is active and working? I am finding at least 18 matches via https://github.com/search?q=org%3Aansys%20LaTeXBuilder%20&type=code but I'd rather try one that you would suggest. I am asking since when I try to reproduce it with only the 2 above lines: diff --git a/doc/source/conf.py b/doc/source/conf.py
index d49cf7c..9dc870c 100644
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -41,9 +41,13 @@ extensions = [
"numpydoc",
"sphinx.ext.intersphinx",
"sphinx_copybutton",
- "sphinx.ext.imgconverter",
+ # "sphinx.ext.imgconverter",
]
+from sphinx.builders.latex import LaTeXBuilder
+
+LaTeXBuilder.supported_image_types = ["image/png", "image/pdf", "image/svg+xml"]
+
linkcheck_ignore = [r"https://tfs.ansys.com:\d+/"]
# Intersphinx mapping
I have been typesetting LaTeX documents with package svg. But it still requires external dependencies:
And it does seem to be the solution employed, as I can only find a single match for Another alternative to
I would like to find a solution where we can debug doc pdf building locally on all Ansys-supported operating systems like Linux and Windows, with minimal external requirements (on Windows, installing imagemagick or Inkscape is simpler than having to setup docker, WSL, etc...). What would be the impediments brought by installing |
@anscfrisson thanks for testing it.
|
Thanks for your insights @Revathyvenugopal162 !
Now with this PR, we get README.rst badges typeset: I understand that having badges in PDFs may not be deemed as important, but for simba-core (as in other potential projects) we may need to add architecture diagrams, and the best pivot format for editing and rendering/typesetting while preserving accessibility might be SVG. From: sphinx.ext.imgconverter
So 2 options to get SVG files properly typeset (rather than being skipped) in projects generated with ansys-templates:
If we already have to install bulky dependencies (such as MikTeX or texlive or basictex) to create PDF documentation, what is the issue with requiring either imagemagick or inkscape (that are both approved by Ansys)? Making SVG support in ansys-templates an option might be cumbersome to implement. What do you think about the above @Revathyvenugopal162 @RobPasMue @jorgepiloto ? |
I'd be fine installing this dependency ( |
Solves warnings when running
poetry run -- make -C doc pdf
and for the CIdoc-build
step:Note: installing imagemagick (
winget install imagemagick
,sudo apt install imagemagick
...) is then necessary to runpoetry run -- make -C doc pdf
: