SUMMARY When click internal links in markdown document, Okular open location of this document in Dolphin. STEPS TO REPRODUCE Create simple MD document with such content: ------------------------>8-------------------- # TEST LINKS 1. [External link to web site](https://kde.org/) 2. [Local link to file](/etc/hosts) 3. [Internal link to chapter](#Chapter) <div style="page-break-after: always;"> ---end-of-page--- </div> # Chapter ------------------------8<-------------------- then open it in Okular OBSERVED RESULT First two links open web-site and local file respectively as expected. Third one (internal link) Okular processes as a path to directory where this document locates and launches Dolphin. EXPECTED RESULT Okular have to follow to the second page of the document, where the target (Chapter) locates. SOFTWARE/OS VERSIONS Linux/KDE Plasma: Ubuntu 20.04 LTS [linux version 5.4.0-29-generic x86_64] KDE Plasma Version: 5.18.4 KDE Frameworks Version: 5.68.0 Qt Version: 5.12.8 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 9.3.0) on "xcb" ADDITIONAL INFORMATION …
Created attachment 128313 [details] attaching the file Next time attach the file instead of making us do the work to create it, the 5 seconds you save us doing this work, it's 5 seconds we can invest in actually investigating the issue
The HTML we get back from discount (the Markdown library we use) is <h1>TEST LINKS</h1>\n\n<ol>\n<li><a href=\"https://kde.org/\">External link to web site</a></li>\n<li><a href=\"/etc/hosts\">Local link to file</a></li>\n<li><a href=\"#Chapter\">Internal link to chapter</a></li>\n</ol>\n\n\n<div style=\"page-break-after: always;\">\n---end-of-page---\n</div>\n\n\n<h1>Chapter</h1> I'm not convinced that at this point we can actually do anything to figure out that <a href=\"#Chapter\"> refers to <h1>Chapter</h1> I'll ask the discount author
ok, using the MKD_TOC flag in discount gives us <a name=\"TEST-LINKS\"></a>\n<h1>TEST LINKS</h1>\n\n<ol>\n<li><a href=\"https://kde.org/\">External link to web site</a></li>\n<li><a href=\"/etc/hosts\">Local link to file</a></li>\n<li><a href=\"#Chapter\">Internal link to chapter</a></li>\n</ol>\n\n\n<div style=\"page-break-after: always;\">\n---end-of-page---\n</div>\n\n\n<a name=\"Chapter\"></a>\n<h1>Chapter</h1> which gives us something to work with
https://invent.kde.org/kde/okular/-/merge_requests/164
Will be fixed by https://invent.kde.org/kde/okular/-/merge_requests/164
Git commit b1c02b7e79c8be1716ddba73d92d5792032821c6 by Albert Astals Cid. Committed on 12/05/2020 at 22:21. Pushed by aacid into branch 'master'. Markdown: Support internal links When processing the <a> elements, store in two maps those that contain an href="#Something" and those with name="Something" then once we've processed them all, go over the first map trying to find itself in the second M +33 -10 generators/markdown/converter.cpp M +3 -2 generators/markdown/converter.h https://invent.kde.org/kde/okular/commit/b1c02b7e79c8be1716ddba73d92d5792032821c6