Is there a way to add a gif to a Markdown file?

后端 未结 9 1454
小蘑菇
小蘑菇 2021-01-29 17:43

I want to add this gif to a GitHub flavored markdown file. If it can\'t be done in GitHub, is it possible to do it in another version of markdown?

相关标签:
9条回答
  • 2021-01-29 18:23

    Showing gifs need two things

    1- Use this syntax as in these examples

    ![Alt Text](https://media.giphy.com/media/vFKqnCdLPNOKc/giphy.gif)

    Yields:

    Alt Text

    2- The image url must end with gif

    3- For posterity: if the .gif link above ever goes bad, you will not see the image and instead see the alt-text and URL, like this:

    Alt Text

    4- for resizing the gif you can use this syntax as in this Github tutorial link

    <img src="https://media.giphy.com/media/vFKqnCdLPNOKc/giphy.gif" width="40" height="40" />
    

    Yields:

    0 讨论(0)
  • 2021-01-29 18:23

    Upload from local:

    1. Add your .gif file to the root of Github repository and push the change.
    2. Go to README.md
    3. Add this ![Alt text](name-of-gif-file.gif) / ![](name-of-gif-file.gif)
    4. Commit and gif should be seen.

    Show the gif using url:

    1. Go to README.md
    2. Add in this format ![Alt text](https://sample/url/name-of-gif-file.gif)
    3. Commit and gif should be seen.

    Hope this helps.

    0 讨论(0)
  • 2021-01-29 18:24
    1. have gif file.
    2. push gif file to your github repo
    3. click on that file on the github repo to get github address of the gif
    4. in your README file: ![alt-text](link)

    example below: ![grab-landing-page](https://github.com/winnie1312/grab/blob/master/grab-landingpage-winnie.gif)

    0 讨论(0)
  • 2021-01-29 18:36

    just upload the .gif file into your base folder of GitHub and edit README.md just use this code

    ![](name-of-giphy.gif)

    0 讨论(0)
  • 2021-01-29 18:37

    Giphy Gotcha

    After following the 2 requirements listed above (must end in .gif and using the image syntax), if you are having trouble with a gif from giphy:

    Be sure you have the correct giphy url! You can't just add .gif to the end of this one and have it work.

    If you just copy the url from a browser, you will get something like:

    https://giphy.com/gifs/gol-automaton-game-of-life-QfsvYoBSSpfbtFJIVo

    You need to instead click on "Copy Link" and then grab the "GIF Link" specifically. Notice the correct one points to media.giphy.com instead of just giphy.com:

    https://media.giphy.com/media/QfsvYoBSSpfbtFJIVo/giphy.gif

    0 讨论(0)
  • 2021-01-29 18:41

    From the Markdown Cheatsheet:

    You can add it to your repo and reference it with an image tag:

    Inline-style: 
    ![alt text](https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png "Logo Title Text 1")
    
    Reference-style: 
    ![alt text][logo]
    
    [logo]: https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png "Logo Title Text 2"
    

    Inline-style: alt text

    Reference-style: alt text


    Alternatively you can use the url directly:

    ![](http://www.reactiongifs.us/wp-content/uploads/2013/10/nuh_uh_conan_obrien.gif)
    
    0 讨论(0)
提交回复
热议问题