yakivmospan / github-wikito-converter

Generate HTML & PDF documentation from Github wiki or any other markdown-based wiki.
Other
293 stars 52 forks source link

Relative paths in content are not correctly handled #46

Open cavo789 opened 5 years ago

cavo789 commented 5 years ago

Hello

There is incorrect management of relative links to images.

Let us imagine the situation:

/wiki_root
     /images/img.png
     /content/parameters.md

Under my wiki_root folder, I've a sub-folder with my images. In my /content/parameters.md file, I put the following code ![](./../images/img.png). To get the image, I need to go one folder up to retrieve the images folder..

Below a preview from within vscode: the first image is displayed; it's normal, the path is correct. On the other hand, the second image isn't displayed, normal tool, the path is incorrect.

2019-07-03_15h55_53

But, the convert tool didn't understand. He can find the ... second image because seems to calculate paths based on the root folder of the wiki. This is wrong. The path is relative to the markdown document; not from the root of the repository.

Is it possible to solve this please ?

Thanks.

Below the result of the conversion when I remove the first (and yet correct) link:

2019-07-03_15h56_39

The second image is displayed and it shouldn't be the case since the path is wrong.

Thanks a lot!

flashpixx commented 5 years ago

I have tested the tool on Gitlab Wiki pages, and the problem still exists here also. The path of an image must be relative to the Markdown file. I can create a working image link for the Wiki xor for the converter call, but not for both.

cavo789 commented 5 years ago

Hello

I've abandoned the idea of using this tool (github-wikito) due to the problem mentioned here above (seems that the image has to be stored in the root of the wiki; my example illustrates that problem).

Now I'm using pandoc to convert a .md file to .html, .pdf, ... At this time, I convert one file but we can of course write small piece of code to first concatenate several .md files into one before creating the output file.

Have a nice day.

connorjak commented 4 years ago

I'm reproducing this issue. My use case is tutorial documentation with lots of links from wiki pages to other wiki pages.

petrkalina commented 4 years ago

using the following syntax

![images/new-image-2.jpg](images/new-image-2.jpg)

results in html like

<img src="data:image/jpeg;base64,/9j/4gIcSUNDX1BST0ZJTEUAAQEAAAIMbGNtcwIQAABtbnRyUkdCI...

and the images are displayed in the PDF. Using i.e.

[[images/new-image-2.jpg]]

results in

<a href="#new-image-2.jpg">images/new-image-2.jpg</a>

html and this translated to non-funuctioning link in the PDF..