You are using Kate or KDevelop and often editing directly the sources of Markdown files, Qt UI files, SVG files, Dot graph files and whatever else formats which are based on plain text files?
And you are having to use a workflow to check the current state which is saving the file and (re)loading it in a separate viewer application?
Could be better, right? Perhaps like this:
Nice mock-up. Or is it? Seems not! So, KParts-based preview plugin for Kate & KDevelop coming soon near you to a well-stocked package repository? Read the whole story where things are heading.
And a Markdown kpart? Never seen before. Because it is new. Actually seems the week of Markdown in the KDE community, there is also a patch on review to add Markdown support for Okular. Sadly Markdown support in Okular with the Okular kpart would not yet replace that separate Markdown kpart, because Okular does not support webview-style display (single “reactive” page), misses support for data streaming without touching the filesystem, and has too much chrome in the kpart for simple usage. Hope is on the future and somebody (you?) improving that. I am doing my share of improving things with this preview plugin, so I am out 🙂
Cool thing Friedrich. One thing I regret re Markdown is that we still have no native previewer for such a simple format while we have previewer for ODF or DOCX…. Web view based code is too easy approach…
Thanks anyway, one day going to fork kmarkdownwebview.git until it’s supported by distros (might by years).
Yes, I feel dirty 🙂 But the Okular markdown plugin could show the way, happy to see that.
kmarkdownwebview currently moving into kdereview, so first release planned for begin of September.
Is it easy to add support for .adoc (asciidoctor) files?
Possibly, and then easy is relative to skills 🙂
You could try to do the same JavaScript-based hack done in the Markdown kpart: exchange marked.min.js with asciidoctor.js in the code and adapt the index.html file as needed (there are two variants of that file, once for webkit, once for webengine.). See https://cgit.kde.org/kmarkdownwebview.git/tree/src/lib/data
No personal motivatoin, so left for someone else to scratch their itch here.
Absolutely amazing! Thank you! Haven’t been excited for a kpart for a long time!
Great ! Will it automatically select an available kpart depending on the milme type ? For example, the kgraphviewerpart for dot files ?
Yes, currently simply the kpart is used which is returned from KMimeTypeTrader::self()->preferredService(mimeType, “KParts/ReadOnlyPart”). (See https://marc.info/?l=kwrite-devel&m=150333078206625&w=2 for some open questions about this)
Actually the kgraphviewerpart has been one of my testing utils, that is how the patch for kgraphviewer at https://phabricator.kde.org/D7329 got triggered, which still wants to be reviewed, hint, hint 😉
Oups! I did not see the notification… Thank you. I accepted the patch.
Since the beginning of (the buggy and unfinished) kgrapheditor, I wanted to add a feature like that. Thanks a lot for implementing it.
Thanks for review! Will push tonight.
what about LaTeX? it would be very nice
If there was a kpart which takes tex files as input and internally processes them and displays the resulting document, e.g. the dvi blob, that would work with this. The preview plugin itself just delegates support for individual formats, i.e. loading a kpart and streaming the data of the current document to it.
I only know of kparts being able to display the dvi files themselves, so those would be of not help here.
Also, right now the design of this first version of the preview plugin assumes single-source-single-product, means it gets fed the text of the one file for which the preview is done. With tex files one usually has multiple of them to help with document structure, and any include commands would fail to work as the data is not passed from the normal filesystem.
In theory this could be one day extended to also work for multi-source-single/multi-product formats, like html, tex or even software source code. But that needs quite some planning and work, and no-one has been seen to work on that.
So the use of dedicated solutions like Kile or KDevelop will stay your (only) choice.
didnt even knew about Kile, thanks for the info, having a integrated Tex editor is pretty useful for my workflow.
Awesome stuff! 😀
A preview pane was the only thing that I was missing in Kate from any other editor.
[…] “Live Preview” plugin for the editors/IDEs Kate & KDevelop (see introduction) makes use of KParts plugins to support different file formats. Thus it can also pick up the range […]
[…] The KMarkdownWebView software provides a KParts plugin for rendered display of Markdown files, using web technologies (webpage with JavaScript library which creates HTML from the plaintext handed in). This enables KParts-using applications (like the archiving tool Ark or the file manager Krusader) to show Markdown files in the target format. It is also prepared for the upcoming “Live Preview” plugin for KTextEditor-based applications like the editors/IDEs Kate & KDevelop (see introduction). […]
Doesn’t work for me using KDE Neon (and some others on reddit), since the preview is using the txt backend. If I open the markdown file in Okular, it uses the correct backend. Could be a KDE Neon packaging bug, but I don’t know. Was going to chime in on https://bugs.kde.org/show_bug.cgi?id=360811#add_comment but decided to do so here first, in case it’s not relevant to that report, or if I should create a new report, or what.
It seems a bug in the Okular KParts plugin, which seems to ignore the mime type passed on invocation.
There is a patch for Okular to approach this, but looks like discussion on it got stuck a little, needs developers to pick it up again: https://phabricator.kde.org/D8690
Cheers! Hope it gets fixed!
BTW, if you want Markdown preview already, one can use the KMarkdownWebView KParts plugin instead of the Okular one. Install that one and in Plasma Systemsettings go to “Applications” > “File Associations”, select “text/markdown” type, chose “Embedded” tab and change the settings to prefer the KMarkdownWebView plugin over the Okular one.