SUMMARY I usually put up a comment on top of my Markdown files, for copyright and licensing information. However, this seems to break the markdownpart preview generator. In Markdown, commens are indicated by `<!-- -->`, with the comment text placed in between the hyphens. Example: ```markdown <!-- SPDX-FileCopyrightText: 2021 Manuel Geißer <geisserml@gmail.com> --> <!-- SPDX-License-Identifier: CC-BY-4.0 --> # Test Description ## Sec 1 * a * b ## Sec 2 * c * d ``` STEPS TO REPRODUCE 1. Paste the above example into Kate or KDevelop 2. Open the Preview panel 3. Click the play button 4. View result 5. Remove the two comment lines 6. View result OBSERVED RESULT With the comments, no preview is visible, only a single dot. Without the comments, the preview looks correct. EXPECTED RESULT The preview should always represent the markdown code correctly, even if there is a comment. SOFTWARE/OS VERSIONS Operating System: KDE neon 5.22 KDE Plasma Version: 5.22.4 KDE Frameworks Version: 5.85.0 Qt Version: 5.15.3 Kernel Version: 5.11.0-27-generic (64-bit) Graphics Platform: Wayland ADDITIONAL INFORMATION The described syntax works correctly with Github preview.
I can confirm this behaviour, Qt 5.15.2 (openSUSE TW). The markdownpart itself is only a wrapper around the markdown support in Qt's QTextDocument. See also info in https://invent.kde.org/utilities/markdownpart/-/blob/master/README.md So this need reporting to and fixing in Qt itself, there is nothing we can do here without implementing a markdown parser ourselves or switching to another engine.
Thanks for the response. Will you file an issue at bugreports.qt.io or should I do this? After a quick look at the existing bug reports, it seems that the QTextDocument markdown engine is not particularly sophisticated and has lots of known issues. Last time I tried, I got equally disappointing results with the other kde markdown previewer, kmarkdownwebview. (I don't remeber anymore whether it was also the comments issue or whether it just didn't work at all.)
Now I also tried the Okular markdown support, but it's somewhat of a joke - it just shows the raw text for me. Is this expected?
Ah, actually it works in Okular when removing the comment lines. Similar issue, apparently.
(In reply to Manuel Geißer from comment #2) > Last time I tried, I got equally disappointing results with the other kde > markdown previewer, kmarkdownwebview. (I don't remeber anymore whether it > was also the comments issue or whether it just didn't work at all.) I just gave kmarkdownwebview a try, and it could cope at least with the example given here. Not working at all was not a bug I can remember about that one, usually it was issues with having it properly configured to be the part to use, or e.g. kate failing to yet detect the markdown format of a file for which preview was wanted. Sorry, myself out of business here when it comes to markdown, and the markdownpart is only "community-maintained" now, so no-one actively driving ti forward, but at best fixing things where easily possible. This needs new human resources :) > Will you file an issue at bugreports.qt.io or should I do this? Please do, as I have no own motivation here. > After a quick look at the existing bug reports, it seems that the > QTextDocument markdown engine is not particularly sophisticated and has lots > of known issues. Sorry to hear that. The disadvantage of relying on an upstream project, even more with the locked situation around Qt 5.15 :/ In a perfect world someone would fork the markdown parsing out of Qt and drive it forwards in an indeoendant project. Using QTextDocument itself for rendering as before should be fine though.
> I just gave kmarkdownwebview a try, and it could cope at least with the example > given here. Not working at all was not a bug I can remember about that one, > usually it was issues with having it properly configured to be the part to use, > or e.g. kate failing to yet detect the markdown format of a file for which > preview was wanted. Actually I double-checked everything was configured correctly by that time, but I'll try kmarkdownwebview again.
Nope, the issue with kmarkdownwebview still persits: - uninstalled markdownpart - installed kmarkdownwebview - configured the file association for embedding - opened file - preview is blank white, no text visible Should I open a new bug report at kmarkdownwebview?
Created attachment 141061 [details] kmarkdownwebview blank preview
(In reply to Manuel Geißer from comment #7) > Nope, the issue with kmarkdownwebview still persits: > - uninstalled markdownpart > - installed kmarkdownwebview > - configured the file association for embedding > - opened file > - preview is blank white, no text visible Sad, thanks for sharing, mental note made. No idea what could be wrong there and thus where to start. > Should I open a new bug report at kmarkdownwebview? Thanks for the offer, just myself as author have abandoned kmarkdownwebview, as the technology used internally is rather insane from a pure design POV, and also might have lots of loop holes for attacks, so being insecure. So any new bug report might be only for the records, until one point in time someone might decide to revive it for whatever reasons. You might want to get in contact with other potential developers and heavy Markdown users to form some critical mass to get active development here going. No idea how to do that best, sorry :) I was once surprised there was 0 support, that's why I had hacked up the preview plugin and kmarkdownwebview in the beginning, but then found there are bigger blockers to make this perfect (starting with embedded images which need proper internal redirection to load), and I had not enough own need to invest more, so actually even once suggested to remove the preview plugin again, but others kept it in -> https://phabricator.kde.org/D16668 So I am out of responsibility here :)
> No idea what could be wrong there Maybe it's due to my theme? The text colour is plain white, so if the background colour is not taken into account, but the text colour is, then it would be white-on-white and the result would be explainable. Thanks for the help and the time you have put into creating markdownpart and kmarkdownwebview. Apparently markdown preview generation is a complex subject and I can understand you don't want to work on it anymore.
> You might want to get in contact with other potential developers and heavy Markdown users > to form some critical mass to get active development here going. I just found out there is a program called QOwnNotes [1], which offers an excellent markdown preview. Maybe it would be possible to work together with the QOwnNotes developers and make that preview generator available to KDE Apps? [1] https://github.com/pbek/QOwnNotes
Created attachment 143806 [details] QOwnNotes Markdown Preview
(In reply to Friedrich W. H. Kossebau from comment #9) > there are bigger blockers > to make this perfect (starting with embedded images which need proper > internal redirection to load) Is it also related to external images? Pictures described like these are not shown for me: [](#readme)