在 Sphinx 的 html 输出中缩放 svg 图(休息)

Scale svg figure in html output of Sphinx (rest)

我有一个使用缩放指令的重组文本中的图形,如下所示:

.. figure:: images/my_image.svg
   :scale: 150 %

图像在 sphinx 的 HTML 输出中完全没问题,除了它没有缩放。 (svg图片有宽高信息和viewBox)

奇怪的是,与png图片相比,HTML文件中的<img>标签不包含图像的宽度和高度属性(hm,sphinx不能确定宽度和 svg 的高度出于某种原因?)。

这是什么原因? sphinx 是否支持 svg 图形的 :scale: 指令?

您可以尝试设置宽度。这个也可以赋当前线宽的百分比作为值。

.. figure:: images/my_image.svg
   :width: 100%