首页 文章

github svg根本没有渲染

提问于
浏览
2

我正在尝试在github中创建一个markdown文件,并希望在其中放入一个svg图像 . github根本不渲染图像 . 我试着用 <img /> ,用 ![]() . 根本就不行!有谁见过这个?

刚刚修改了存储库以便公开:https://github.com/michelucci/deepbook

在此先感谢,翁贝托

3 回答

  • 0

    GitHub的降价似乎阻止了SVG文件,但您始终可以使用裸HTML标记:

    <img src="neuron_fig1.svg"/>
    
  • 0

    有关任何内联HTML的信息,请参阅issue 458,但由于它不是您的问题,您可以将your pagethis one进行比较:它确实显示了很多svg图片及其source is here .

    "source": [
        "## Python Objects\n",
        "\n",
        "We begin with a look at a Python object. In Python, objects are stored in memory blocks independently allocated on the heap. A single floating point value looks something like this:\n",
        "\n",
        "![Python Float](fig/python_float.svg)\n",
        "\n",
        "This doesn’t look too bad, in a dynamically typed system we need to store some metadata about the type, and we need to store the data containing the value."
       ]
      },
    

    所以相对URL(到docs/intro-01/fig)确实有效 .

    你的代码:

    "source": [
        " ![](neuron_fig1.svg) \n",
        " **Fig. 1** The structure of a neuron. $x_i$ are the input, $w_i$ are the weights."
       ]
    
  • 0

    看起来GitHub现在需要在SVG字符串末尾的http查询参数 sanitize=true . 如果您从Wiki中链接到存储库中的图像,则可能已在URL的末尾添加了参数 . 因此,如果没有查询参数,则添加 ?sanitize=true ,否则添加 &sanitize=true

    <img alt="my image" src="https://raw.githubusercontent.com/user/branch/images/myimage.svg?example=foo&sanitize=true>
    

相关问题