Ask coding questions

← Back to all posts
Markdown image not working
isaiah08

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?

Voters
namer707
isaiah08
Comments
hotnewtop
Wesam_Issawi_Is

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

isaiah08

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

PattanAhmed

@isaiah08 Hi,
What about this:-

Try and tell me the results below.
Thanks!

Hope this helps

isaiah08

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

PattanAhmed

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

isaiah08
PattanAhmed

@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

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
DynamicSquid

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

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

isaiah08

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

Coder100

It has to be an absolute path.

isaiah08

What do you mean? @Coder100

Coder100

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

isaiah08

https://repl.it/@isaiah08/tutorialed#python/machinelearning/lesson1.md
Search for ![A visualised decision tree](images/decision_tree.png) @Coder100

Coder100
Coder100

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

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

Coder100
Coder100

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

isaiah08

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

Coder100

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

isaiah08

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

Coder100
Coder100

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

isaiah08

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

Coder100

yeah @isaiah08

isaiah08

STILL not working! @Coder100

Coder100

what @isaiah08

Coder100

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

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

Coder100

awesome @isaiah08

Coder100

does it work? @isaiah08

isaiah08