gitblit-org / gitblit

pure java git solution
http://gitblit.com
Apache License 2.0
2.28k stars 670 forks source link

markdown image issue #1306

Open Symous opened 5 years ago

Symous commented 5 years ago

Just find out that gitblit is not support img tag to showing images, so I use ![Image](link...), but can not control the size of that. Any solution here?

chirontt commented 5 years ago

Standard Markdown doesn't support image size. Some extensions support it. Anyway, you can resize your image to your desired size first. Failing that, you can put raw HTML code in the Markdown document to control its size, like:

<img src="img_girl.jpg" alt="Girl in a jacket" width="500" height="600">

and the parser should leave the raw HTML code as is during conversion.

Symous commented 5 years ago

@chirontt thanks my friend, but HTML image element didn't show the picture. I ues gitblit 1.8.0 :(

White-Lee commented 5 years ago

Did you solve it? @Symous

Symous commented 5 years ago

@White-Lee not yet.

stoutg commented 3 years ago

@Symous @White-Lee I was able to get the img tag to work. I have a file called flowchart.png in a folder called mdResources in the root of my repository. If I set the img src to ../raw/repoName.git/master/mdResources/flowchart.png then I can get the image to show. The width and height attributes also work with the img tag.

<img src="../raw/repoName.git/master/mdResources/flowchart.png" alt="flowchart" width="500" height="600" />

stoutg commented 3 years ago

Unfortunately, there is a bootstrap CSS that specifies any image has a max width of 100%. If your images width exceeds the width of the page then it is set to the page width and the images height is not scaled accordingly so the image becomes skewed. img { max-width: 100%; }

I have not found how to override that.
I tried specifying an inline style: style="max-width:none;" but it gets stripped out by the markdown parser. In the bootstrap CSS there is another entry, #map_canvas img { max-width: none; }. I tried surrounding the img tag with a div and span (not both at once) with an id of map_canvas. The id attribute was stripped out just like the style attribute.

I have a very large flowchart that is unreadable when it is shrunk down to fit on the page so I would like to disable the max-width. If anyone knows how, I would appreciate the assistance.