Bug 385755 - preview for md document doesn't work
Summary: preview for md document doesn't work
Status: RESOLVED DUPLICATE of bug 384973
Alias: None
Product: kate
Classification: Applications
Component: plugin-preview (show other bugs)
Version: Git
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-10-14 18:38 UTC by Piotr Mierzwinski
Modified: 2017-12-19 19:07 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
example of README.md (1.91 KB, text/markdown)
2017-10-14 18:38 UTC, Piotr Mierzwinski
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Piotr Mierzwinski 2017-10-14 18:38:36 UTC
Created attachment 108353 [details]
example of README.md

I open README.md (attached) by "Open with" (in Dolphin) and see "No preview available".

I have installed (from AUR) plugin mentioned in article: https://frinring.wordpress.com/2017/10/09/ktexteditorpreviewplugin-0-2-0/

$ ls -l /usr/lib/qt/plugins/ktexteditor/ktexteditorpreviewplugin.so
-rwxr-xr-x 1 root root 69072 10-12 00:20 /usr/lib/qt/plugins/ktexteditor/ktexteditorpreviewplugin.so

Seems that properly plugin is not loaded despite I have checked "Document preview" plugin in Kate, but if I open any "ui" file ("Open with" from Dolphin) then after switch (in Kate) to tested README.md preview starts work! It happens like that even KUIViewer is not installed in system. After installation nothing changed, only ui file is properly shown.
Comment 1 Friedrich W. H. Kossebau 2017-10-14 21:17:51 UTC
The KTextEditorPreview plugin itself does not preview Markdown files. You need to have a KParts plugin installed which supports Markdown files, e.g. the KMarkdownWebView KParts plugin (see https://frinring.wordpress.com/2017/09/30/kmarkdownwebview-0-2-0/).

What do you see in the "hamburger" menu for the "About KPA>RTSPLUGIN" when you see a preview, for UI files and for MD files?

Chance is that you are hitting the issue as described here: https://bugs.kde.org/show_bug.cgi?id=384973
Comment 2 Piotr Mierzwinski 2017-10-15 03:05:28 UTC
I have plugin you mentioned:
$ ls -l /usr/lib/qt/plugins/kmarkdownwebviewpart.so 
-rwxr-xr-x 1 root root 64840 10-01 01:57 /usr/lib/qt/plugins/kmarkdownwebviewpart.so

$ pacman -Q | grep -i kmarkdownweb
kmarkdownwebview 0.2.0-1
$ pacman -Q | grep -i ktexteditorpreviewp
ktexteditorpreviewplugin 0.2.0-1

BTW. In installation procedure there is some bug. In Arch /usr/lib64 is linked to /usr/lib and as far as I remember you try to create this (/usr/lib64) directory, so happens error in moment of installation. I just copied manually the plugin, after I built it.

$ ls -l /usr/lib64/qt/plugins/kmarkdownwebviewpart.so 
-rwxr-xr-x 1 root root 64840 Oct  1 01:57 /usr/lib64/qt/plugins/kmarkdownwebviewpart.so
$ ls -l /usr/lib64/qt/plugins/ktexteditor/ktexteditorpreviewplugin.so
-rwxr-xr-x 1 root root 69072 Oct 12 00:20 /usr/lib64/qt/plugins/ktexteditor/ktexteditorpreviewplugin.so

Back to current issue.
When I open md file then "Hamburger" menu is disabled and the same "Update the preview ..." button.
Enabled are following buttons: "Lock preview ..." and "Enable automatic updates ...".
When I open ui file then "Hamburger" menu is enabled in ui preview and becomes enable in preview md file.

In ui preview
- "About KUIViewerPart -> About": 
     Displays Designer's UI files
- "About KUIViewerPart -> Libraries": 
     KDE Frameworks 5.38.0
     Qt 5.9.2 (built against 5.9.1)
     The xcb windowing system
- "About KUIViewerPart -> Authors": 
     Richard Moore
     Ian Reinhart Geiser

In md preview:
- "About KMarkdownWebViewPart -> About":
     For the rendered display of Markdown files in a webpage-like layout
- "About KMarkdownWebViewPart -> Libraries"
     KDE Frameworks 5.38.0
     Qt 5.9.2 (built against 5.9.1)
     The xcb windowing system
- "About KMarkdownWebViewPart -> Authors"
     Friedrich W. H. Kossebau

Probably this bug is related with reported by you. I mean bug id: 384973. I observed the same issue when I opened in Kate as first ui file (no preview) and second md - preview turned on for both. Both I opened by "Open with" from Dolphin.
I noticed that dependent bugs: 384448 384449 are not fixed yet. I have the latest stable: Qt5. Plasma, KF and KApplications, but it changes nothing if bugs in Kate are still not fixed.
Comment 3 Friedrich W. H. Kossebau 2017-10-17 16:11:00 UTC
(In reply to Piotr Mierzwinski from comment #2)
> BTW. In installation procedure there is some bug. In Arch /usr/lib64 is
> linked to /usr/lib and as far as I remember you try to create this
> (/usr/lib64) directory, so happens error in moment of installation. I just
> copied manually the plugin, after I built it.

Please report this to the Arch packager(s) then. The build system installs the plugin with a usual install instruction and location variable:
    install(TARGETS ktexteditorpreviewplugin DESTINATION ${KDE_INSTALL_PLUGINDIR}/ktexteditor)

So it might be rather a packaging issue.

> Probably this bug is related with reported by you. I mean bug id: 384973. I
> observed the same issue when I opened in Kate as first ui file (no preview)
> and second md - preview turned on for both. Both I opened by "Open with"
> from Dolphin.

Yes, seems to me very much this is 384973, so will close this as duplicate bug report then.

> I noticed that dependent bugs: 384448 384449 are not fixed yet. I have the
> latest stable: Qt5. Plasma, KF and KApplications, but it changes nothing if
> bugs in Kate are still not fixed.

Yes, no-one seems to have yet started to work on a solution. So we are left for now only with the hope someone will be annoyed enough one day to tackle that coding challenge.

*** This bug has been marked as a duplicate of bug 384973 ***
Comment 4 Michael D 2017-12-19 18:30:08 UTC
I can't get markdown preview in KDE Neon either. Works fine if I open the document in Okular.
Comment 5 Friedrich W. H. Kossebau 2017-12-19 18:48:28 UTC
(In reply to Michael D from comment #4)
> I can't get markdown preview in KDE Neon either. Works fine if I open the
> document in Okular.

Thanks for taking the time to do your report. Sadly though it does not add information as "can't get markdown preview in KDE Neon either" can mean anything.

You could get "text only" preview like it currently happens possibly due to a bug in Okular (see https://phabricator.kde.org/D8690 for a potential fix), or no preview at all.
So please read through the existing comments on this bug report and also the one for which this one was closed as duplicate. Then tell what you experience yourself and how it relates to the reported issues. TIA.
Comment 6 Michael D 2017-12-19 19:07:39 UTC
I get a text-only preview. Seems to be the bug you link to concerning not being able to pass mime type to okular. Unfortunately I've no time to go through the whole report here or the marked-as-duplicate one. I'm swamped--sorry!