VSTS WIki Using HTML Img Tag - azure-devops

Because I wanted to be able to re-size images in markdown I've been using the HTML img and specifying the desired width/height.
I'm referencing the image using a relative path, so for example for markdown in the same directory as an images folder I'd write:
<img src="./Images/MyImage.png" width="600">
This has all worked fine using Visual Studio Code but when the markdown is pushed to the VSTS Wiki it isn't rendering the image.
Is this a bug or is the img tag not supported?

You can use the following syntax to resize them (see =WIDTHxHEIGHT at the end):
Notice though that the syntax to support image resizing is only supported in pull requests and the Wiki.
![Image alt text]($/project/folder/_img/markdown-guidance/image.png =WIDTHxHEIGHT)
So for your use case I would use (in your markdown files):
![Image alt text](./Images/MyImage.png =600x)
Please refer to the following documentation for images in markdown.
https://learn.microsoft.com/en-us/vsts/project/wiki/markdown-guidance?view=vsts#images

The Wiki of course support the standard HTML syntax. Please see this blog for details.
Q : This has all worked fine using Visual Studio Code but when the
markdown is pushed to the VSTS Wiki it isn't rendering the image.
The
The root cause is that you used a relative path, <img src="./Images/MyImage.png" width="600">, the image can be found on you local machine. So you can see the image when open the markdown file in Visual Studio Code locally.
However when you pushed to the VSTS, the path is changed. So it cannot find the image for rendering the image in Wiki. You need to capture the link address (URL) for the image, then use the URL in img tag like this:
<img src="https://xxx.visualstudio.com/f081441f-c072-4ed5-9407-85683e9b0888/_apis/git/repositories/e291904f-4668-4fba-8575-3f67898e3058/Items?path=%2Ftest%2F0116-workspace.png" width="600">

Related

Github readme.md showing plain code instead of title for url

I'm trying to use a url but show only Title not full url.
But its not working and showing plain code:
That would be the case:
in the editor section of a markdown file (if you click on preview, you would actually see a link).
Actually complete the edit (commit your change) and check if the link is proprely displayed.
in a <pre></pre> section
in a file which is not a markdown (does not end with the .md extension), like a .txt file, which should not be your case.

Rendering svg images in Jupyter notebook markdown on GitHub

The markdown code below can be rendered in Jupyter notebook locally in my browser, but it doesn't reader on GitHub (instead shown as broken image icons)
<img src="img/plot1_m_over_n=5.svg" width="500"> <img src="img/plot2_m_over_n=10.svg" width="500">
There's a lot of math so I used Jupyter notebook (LaTeX) for the readme (no code cells, just lots of markdown cells), and I know there is a python solution here (In [8]), but I don't want to show the python code. I just want the SVGs to be rendered! Plus it can't resize the svg. How can I adjust the markdown code above so that it can be rendered on GitHub?

Who create this rectangle in VIsual Studio Code markdown text edit?

Please look up this picture. I opened Visual Studio Code 1.31.0, create new file,
write below, then, the rectangle shown in this picture was appeared.
```a`a```
I opened Developper tool and checked DOM. I edit <div style="top:0px;height:19px;" class="view-line">(top:0px => top:10px), then, the rectangle doesn't moved.
So, I checked around this element. However, threre is anything like creating the rectangle.
In my Visual Studio Code, too many extension is installed, see here
Markdown related extension list is below:
$code --list-extensions | grep markdown
bierner.markdown-emoji
bierner.markdown-mermaid
DavidAnson.vscode-markdownlint
geeklearningio.graphviz-markdown-preview
shd101wyy.markdown-preview-enhanced
TomasHubelbauer.vscode-markdown-table-format
yzhang.markdown-all-in-one
So, I download Visual Studio Code Insider 1.32.0, install extensions shown below one by one, the rectangle was not drawn.
Who cretate the rectangle? Or, how to investigate?
As far as I know, markdown-it recognize the markdown as single code tag so that non markdown-it related process draw the rectangle, I think.
Environment
Windows 10 Home 1809
Visual Studio Code 1.31.0
This is a feature introduced in v1.5.0 of Markdown All in One. You can control it with setting markdown.extension.syntax.decorations.

Add images to README.org files in Gitlab

A method to add images to markdown files in Github is described here. However, I would like to add images to *.org files in Gitlab (both Github and Gitlab support README.org files, so the solution should be equal for both). I've tried:
[[file:./path/to/file.svg]]
[[sometext][file:./path/to/file.svg]]]
[[file:./path/to/file.svg]][sometext]]
Markdown's format doesn't work either:
![alt text](./path/to/file.svg)
A now removed answer suggested using
![][1]
[1]: ./path/tofile
which doesn't work either.
What is the right way to do it?
Insetting html works for both Gitlab and Github.
#+html: <p align="center"><img src="path/to/file" /></p>
#+caption: <img description> (optional)
#+attr_html: :width 50 px
#+attr_html: :height 50 px
[[<path to image>]]
For more check the orgmode manual.

How to include image as Markdown in Visual Studio Code?

How can I include an image from the same destination folder as of the document as Markdown in Visual Studio Code?
I tried this, but it didn't work:
![Getting Started](./2/to/img.jpg)
If the image is in the same directory as the Markdown file, you can use either:
![Getting Started](./img.jpg)
![Getting Started](img.jpg)
For a workspace layout like:
docs/
images/
img.jpg
README.md
In README.md, this would be either:
![Getting Started](./images/img.jpg)
![Getting Started](images/img.jpg)
Question is old, however, I found a very nice plugin within visual studio code
Paste Image
As the plugin suggests you can paste the image onto markdown file by pressing ctrl(cmd) + Alt +V.
Or
Open command palate pressing ctrl(cmd) + shift + p and select paste image. In the background the plugin creates a image file with date/time and puts reference on the markdown.
If you are here because the images would not render in vscode preview, here's my solution:
<img src="./2/to/img.jpg" alt="Getting started" />
Markdown accepts HTML syntax, so this just works also.
Instead of this Process you can just drag the image from the file and to include in the Readme.md just click Shift + release It Will be generated Automatically.
Well if the pic is from the internet
I think this code will work ![Getting Started](link to access the image)
If the image isn't rendering, in VSC it needs an extra line after the line where the image is instantiated, in other words it can't be an end of file. I do not see this requirement in other markdown editors.
Pasting images seems to be currently in experimental phase on VSCode.
According to this, you can set the following configuration options on your personal settings to enable it.
"markdown.experimental.editor.pasteLinks.enabled": true,
"editor.experimental.pasteActions.enabled": true
My test run of it worked perfectly pasting a screen capture, but it seems there's currently no setings as on where the file will be saved or its name. It defaults to saving on the current folder with "image.png" name.