Bug 386600 - Okularpart renders markdown as regular text
Summary: Okularpart renders markdown as regular text
Status: RESOLVED FIXED
Alias: None
Product: okular
Classification: Applications
Component: general (show other bugs)
Version: 1.2.70
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-11-06 19:15 UTC by Edward Kigwana
Modified: 2018-02-25 10:45 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Edward Kigwana 2017-11-06 19:15:07 UTC
File opened via okular renders as expected. Same file viewed via ktexteditorpreviewplugin renders plain text. Selecting kmarkdown web view part instead of okularmd shows what I'd expect.
Comment 1 Julian Wolff 2017-11-07 10:00:56 UTC
This is not a problem in Okular, but in the (experimental) KTextEditorPreviewPlugin.

Due to the way this plugin forwards the file to Okular, Okular can't know the mime type of the file, thus falls back to plain text.

See https://phabricator.kde.org/D7455#138854
Comment 2 Julian Wolff 2017-11-07 10:04:25 UTC
Friedrich, can you confirm this?
Comment 3 Friedrich W. H. Kossebau 2017-11-07 10:17:11 UTC
I do not have Okular from master branch, so cannot test this myself for Markdown documents.

But the KParts plugin used should know about the mimetype, it is passed both when loading via a file and when loading via a stream. 
Cmp. KPartView::updatePreview():
https://cgit.kde.org/kate.git/tree/addons/preview/kpartview.cpp#n161
(merged now into the kate repo)

So by theory (and experience with other KParts plugins) the Okular KParts plugin "should" know about the mimetype, so without knowing more I suspect some issues on the Okular side :)
Comment 4 Julian Wolff 2017-11-07 10:47:34 UTC
Thanks for clarifying.

I will look into this then.
Comment 5 Albert Astals Cid 2018-02-25 10:45:09 UTC
Git commit d19834f231acc31d058978b1f01b70c0eee332bf by Albert Astals Cid, on behalf of Julian Wolff.
Committed on 25/02/2018 at 10:46.
Pushed by aacid into branch 'Applications/17.12'.

Make Part::openUrl not discard OpenUrlArguments

Applications using Okular as a KPart might set a file's mime type in the OpenUrlArguments.
Okular currently clears the arguments while opening a document. This revision fixes this, allowing
applications to actually pass a file's mime type to Okular.

M  +17   -0    autotests/parttest.cpp
M  +6    -0    part.cpp

https://commits.kde.org/okular/d19834f231acc31d058978b1f01b70c0eee332bf