gitblit icon indicating copy to clipboard operation
gitblit copied to clipboard

markdown image issue

Open Symous opened this issue 6 years ago • 6 comments

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?

Symous avatar Apr 25 '19 02:04 Symous

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.

chirontt avatar Jun 02 '19 12:06 chirontt

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

Symous avatar Jun 03 '19 01:06 Symous

Did you solve it? @Symous

White-Lee avatar Aug 15 '19 08:08 White-Lee

@White-Lee not yet.

Symous avatar Aug 22 '19 01:08 Symous

@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 avatar Oct 23 '20 20:10 stoutg

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.

stoutg avatar Oct 23 '20 21:10 stoutg