4

I am using Stash (which has Git) for my project

I am trying to add some images to my Readme.md file as

[picture](http://stash.xxxxxx.com/projects/zzzzz/img/abc.png)

but its not working. when i view the readme, all i see is the plain text

![picture](http://stash.xxxxxx.com/projects/zzzzz/img/abc.png)

please help

EDIT:

Note that stash might be rendering markdowns differently and thats why the conventional solutions to github markdowns might not be applicable. still if somebody know an alternate way of doing this, please let me know.

EDIT2

ok, so here is part of the problem

i had the text for the image as part of the text in an ordered list. as you might know, the lists follow an indentation pattern. when i took the text for the image out of the indentation, and added ?raw at then end of the url, the image showed up. Follow up: can i use something similar to the html img tag in order to resize my image ? also is it necessary for me to de-indent the text for referencing the image ? i still can't escape the quotes

Final EDIT:

found the solution for escaping special characters

i had to replace the special characters with their corresponding entity number as per

http://www.freeformatter.com/html-entities.html

AbtPst
  • 7,778
  • 17
  • 91
  • 172
  • 1
    I'm not familiar with Stash; are you sure that it renders Markdown? – Makoto Aug 26 '15 at 15:34
  • 1
    possible duplicate of [Add images to readme.md on GitHub](http://stackoverflow.com/questions/14494747/add-images-to-readme-md-on-github) – Arjang Aug 26 '15 at 15:35
  • @Makoto i have been told that it does. i will investigate more – AbtPst Aug 26 '15 at 15:40
  • 1
    @user2984552, thanks. yes i have tried that approach as well but it does not work – AbtPst Aug 26 '15 at 15:41
  • 1
    It does work. I just tried it in my Stash. – Arjang Aug 26 '15 at 15:47
  • thanks @user2984552 can you please share the line of code ? also i i cant seem to be able to escape quotes. i tried using \' but this shows up as \� does stash render markdowns differently ? – AbtPst Aug 26 '15 at 15:58
  • 1
    I did not do anything special. It looks exactly like your second link above. – Arjang Aug 26 '15 at 16:04
  • thanks, that is strange. i am also quite new to git and stash. could it be related to the version of stash i am using, if there is such a thing ? – AbtPst Aug 26 '15 at 16:11

3 Answers3

2

You will need to add ?raw to the end of the URL to the image, so Stash will serve up the image, instead of showing you the file image history.

Larry Shatzer
  • 3,579
  • 8
  • 29
  • 36
2

The Stash/BitBucket documentation for images https://confluence.atlassian.com/bitbucketserver/markdown-syntax-guide-776639995.html#Markdownsyntaxguide-Images provides markdown syntax to just link images "first class". Assuming my README.md is at the root of my project,

![Sequence Diagram](./doc/fields_seq_diagram.png)

...works like a champ on a directory structure like

tcc-rkuhar:shaggy robert.kuhar$ tree --charset=ascii
.
|-- README.md
|-- doc
|   |-- fields_seq_diagram.png
|   `-- fields_seq_diagram.txt
|-- project.clj
Bob Kuhar
  • 10,838
  • 11
  • 62
  • 115
1
  1. One way is to use the markdown syntax of adding an image. This is possible because this file is a markdown file. The syntax looks like:

    ![Alt text](image link):

  2. You can simply drag and drop Images