shaarli / Shaarli

The personal, minimalist, super-fast, database free, bookmarking service - community repo
https://shaarli.readthedocs.io/
Other
3.4k stars 287 forks source link

Markdown conversion from wiki to documentation break links #416

Closed ErwanLeroux closed 7 years ago

ErwanLeroux commented 8 years ago

Hello,

I think there is something wrong in the html version of doc/Home.md

First link Welcome to the <a href="https://github.com/shaarli/Shaarli/">Shaarli</a> wiki<embed src=".html" /> Notice the <embed> part

Second link For general info, read the <a href="https://github.com/shaarli/Shaarli/blob/master/README.md">README</a>.<a href=".html"></a> Notice the second <a>

There is more wrong links in the page, I will not list all of them because I think they all have the same cause. In doc/Home.md, I see this "[](.html)", which look like a typo.

Edit to show the link using proper Markdown syntax

alexisju commented 8 years ago

Wich version of shaarli is concerned / do you use?

The demo instance doesn't have this issue : http://shaarlidemo.tuxfamily.org/Shaarli/doc/Home.html

ErwanLeroux commented 8 years ago

I use the stable version.

alexisju commented 8 years ago

Do you have a link to you doc?

ErwanLeroux commented 8 years ago

Here you go : http://shaarli.elendar.fr/doc/Home.html

alexisju commented 8 years ago

Indeed. I guess it is a little bug of the compiler from wiki to html...

ErwanLeroux commented 8 years ago

Not sure, I think there is something wrong directly in the .md.

What is the purpose of [](.html) ? It look like a incomplete link.

alexisju commented 8 years ago

I think the md is generated directly from the wiki https://github.com/shaarli/Shaarli/wiki This .md is not supposed to be edited manually.

ErwanLeroux commented 8 years ago

Okay I was thinking the other way around, ie that the .md was the source of the wiki ^^

ErwanLeroux commented 8 years ago

I clone the wiki and checked, no trace of [](.html) inside, so something happens when the wiki is duplicated in doc/

ErwanLeroux commented 8 years ago

I found other wrong links Inside Developpement.md <a href="(https://api.travis-ci.org/shaarli/Shaarli.svg)](https://travis-ci.org/shaarli/Shaarli).html"><img src="https://travis-ci.org/shaarli/Shaarli" alt="(https://api.travis-ci.org/shaarli/Shaarli.svg)" /></a> Inside Example-patch---add-new-via-field-for-links.md + echo '<description><![CDATA['.nl2br(keepMultipleSpaces(text2clickable(htmlspecialchars($link['description'])))).$via.$descriptionlink.'[></description>'."\n</item>\n";](></description>'."\n</item>\n";.html)

It look like a regex is messing around when transposing from Github to .md

Edit: the regex probably look like replace [[(.*)]] by [\1](\1.html)

virtualtam commented 8 years ago

Hi @ErwanLeroux!

Please keep in mind that the current format for the local documentation is more of a convenience hack than a proper support:

Feel free to submit a PR if you find a simple fix for the documentation make targets though :)

ErwanLeroux commented 8 years ago

Thanks @virtualtam, I saw that part of the makefile earlier, but I did not understand all of it. The generation of the doc is make htmldoc right ? I'm going to poke around to see what I can do.

virtualtam commented 8 years ago

To elaborate a bit: we use Pandoc to generate HTML documentation from the GitHub wiki pages.

Here's what is done by each Makefile target:

The whole process is quite a succession of hacks, resulting in a local documentation that is browsable enough...

Broken links mostly come from the GitHub-flavoured Markdown syntax (especially handy shortcuts for relative links) not being fully supported by Pandoc. So there is a risk that when fixing parsing for some links, other will end up being broken :(

ErwanLeroux commented 8 years ago

Thanks for the details, I figured as much, although I can't claim I understand all of the command used :) I'm currently testing a php script to use the github api to convert from GFM to html.

ErwanLeroux commented 8 years ago

All wrongs come from the use of [[Unit tests]] syntax on the wiki. I'm trying more regex to take account of this syntax

ArthurHoaro commented 8 years ago

Maybe we can just don't use this syntax?

ErwanLeroux commented 8 years ago

It's a possibility. At least I would recommend to not use it on image. [[images/firefoxshare.png]] should be ![](/shaarli/Shaarli/wiki/images/images/firefoxshare.png)

Note for later: On the sidebar, [[Home]] should be translated to [Home](../Home) Reference : https://help.github.com/articles/adding-links-to-wikis/

ArthurHoaro commented 8 years ago

Didn't make any test, but also relevant.

ErwanLeroux commented 8 years ago

I just tested it a bit [plugins](Plugin-System) : https://github.com/shaarli/Shaarli/wiki/Shaarli-configuration/Plugin-System [plugins](Plugin-System.md) : https://github.com/shaarli/Shaarli/wiki/Shaarli-configuration/Plugin-System.md

It seems that [xx](xx) and [xx.md](xx.md) are considered differents pages.

virtualtam commented 7 years ago

Closed per #772, see also #312