Ask coding questions

← Back to all posts
Markdown image not working
isaiah08 (63)

This is not chat markdown. I am working on a program that uses flask to display markdown files. When I add an image (under the directory images/decision_tree.png) and I add to my markdown ![A visualized decision tree](images/decision_tree.png), it won't show the image. What is wrong?

Comments
hotnewtop
Wesam_Issawi_Is (1)

Did you ever figure out your issue.... I have the same one... same nonsense

isaiah08 (63)

No, I have not. Do you know a solution? @Wesam_Issawi_Is

PattanAhmed (1397)

@isaiah08 Hi,
What about this:-

.../images/decision_tree.png

Try and tell me the results below.
Thanks!

Hope this helps

isaiah08 (63)

hmm... This does not seem to be working either. Can you give me the full line?
@PattanAhmed

PattanAhmed (1397)

@isaiah08 Please link your Repl and say in which path is that thing available?
Thanks!

PattanAhmed (1397)

@isaiah08 Hmm...
I never saw this line of code in your Repl.
![A visualized decision tree](images/decision_tree.png)
can you say where it is available?

DynamicSquid (4631)

or if that doesn't work, you can just open the image in a new tab, and use the url of that as the image path

DynamicSquid (4631)
../images/decision_tree.png
DynamicSquid (4631)

Try to use ../ to go back a directory, for example:

images
  picture
src
  code

in the src/code file, if you want to access the picture, you have to do:

../images/picture
isaiah08 (63)

Not sure what your saying, can you give me an example? @DynamicSquid

Coder100 (16968)

It has to be an absolute path.

Coder100 (16968)

@isaiah08 oh wait as in your index.md?
can i see your repl?

Coder100 (16968)

ok, so basically that's because you are doing the relative path, you have to go back to the root directory to access, the image folder. Your new image url has to be: ../images/decision_tree.png @isaiah08

isaiah08 (63)

So i just need to create a new folder to put the images folder in? @Coder100

Coder100 (16968)

just change your path to what I said and it will work @isaiah08

isaiah08 (63)

It is still not working, can you give me the full line? @Coder100

Coder100 (16968)

![A visualized decision tree](../images/decision_tree.png) @isaiah08

isaiah08 (63)

I did that, and it still won't work. @Coder100

Coder100 (16968)

found out why, You are inside two folders.
![A visualized decision tree](../../images/decision_tree.png)
@isaiah08

isaiah08 (63)

Ok, so it is the amount of folders the markdown is in, not the image is in? @Coder100

Coder100 (16968)

you did it wrong, you are supposed to have ![A visualized decision tree](../../images/decision_tree.png), 3 dots is invalid. two dots goes back to the parent folder remember? @isaiah08

isaiah08 (63)

I know, i was trying PattanAhmed's suggestion. I changed it back to your's now. @Coder100