Skip to content

Instantly share code, notes, and snippets.

@uolcano

uolcano/.block Secret

Last active March 24, 2017 03:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uolcano/e7dd8c16489f82835f73d131d2319422 to your computer and use it in GitHub Desktop.
Save uolcano/e7dd8c16489f82835f73d131d2319422 to your computer and use it in GitHub Desktop.
Test linking to image
scrolling: yes
border: no
license: mit

测试gist的图片引用

内部引用

  1. ![Koala](Koala.jpg)
    Koala
  2. ![Koala](gist-id/Koala.jpg)
    Koala
  3. ![Koala](raw/Koala.jpg) 访问时gist-url末尾必须加斜杠/
    Koala
  4. ![Koala](gist-url/Koala.jpg)
    Koala

外部引用

  1. 从Gist引用
    1. 利用rawgit.com/user/gist-id/raw/file
      Koala
    2. 利用bl.ocks.org/user/raw/gist-id/file 只加载js/css渲染html页面,gist下必须有index.html页面引用了图片https://bl.ocks.org/user/gist-id同时渲染markdown文件
      Koala
    3. gist.githubusercontent.com/user/gist-id/raw/file
      Koala
  2. 从GitHub仓库引用
    1. 利用rawgit.com/user/repo/branch/path/to/file
      Koala
    2. raw.githubusercontent.com/user/repo/branch/path/to/file
      Koala

注意:以上的图片引用在文件的路径前都可以加上一个blob-id,即.../blob-id/path/to/file或者.../blob-id/file,但由于blob-id是根据文件生成的,不可预测,所以引用文件时不宜加入。

参考

Is it possible to make relative link to image in a markdown file in a gist?

<h2>index.html test the relative link to files</h2>
<p>click the following links, and then see what happens to the relative link to image:</p>
<ol>
<li><a href="https://rawgit.com/uolcano/e7dd8c16489f82835f73d131d2319422/raw/index.html">https://rawgit.com/uolcano/e7dd8c16489f82835f73d131d2319422/raw/index.html</a></li>
<li><a href="https://bl.ocks.org/uolcano/raw/e7dd8c16489f82835f73d131d2319422">https://bl.ocks.org/uolcano/raw/e7dd8c16489f82835f73d131d2319422</a></li>
<li><a href="https://bl.ocks.org/uolcano/e7dd8c16489f82835f73d131d2319422">https://bl.ocks.org/uolcano/e7dd8c16489f82835f73d131d2319422</a></li>
</ol>
<img src="Koala.jpg" />
MIT License
Copyright (c) [year] [fullname]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment