KMarkdownWebView 0.2.0

KMarkdownWebView 0.2.0 has been released.

Example: KMarkdownWebView KParts plugin and KMarkdownWebView KIO thumbnail generator plugin used by Krusader

The KMarkdownWebView software is for the rendered display of Markdown documents, using web technologies (native wrapper around a webpage with a JavaScript library which creates HTML from the plain text handed in).
The software contains

  • a KParts plugin for rendered display of Markdown files, which enables KParts-using applications (like the archiving tool Ark or the file manager Krusader) to show Markdown files in the target format.
  • a Markdown file KIO thumbnail generator plugin, which allows KIO-powered file managers & dialogs to show thumbnails and previews of files in Markdown format in the target format (currently only available when building against QtWebKit)

The KMarkdownWebView KParts plugin is also prepared for best experience with the KTextEditor Document Preview plugin for KTextEditor-based applications like the editor Kate and IDE KDevelop.

KMarkdownWebView can be built both with QtWebEngine (preferred by the build system) and QtWebKit. Pass -DUSE_QTWEBKIT=TRUE to CMake to enforce the use of QtWebKit.

Download from: https://download.kde.org/stable/kmarkdownwebview/0.2.0/src/

sha256: c5a73c02bd2761d1786b080148e465ef69e4686d17e6adfc047350f36e7f6b16 kmarkdownwebview-0.2.0.tar.xz

Signed with my new PGP key
E191 FD5B E6F4 6870 F09E 82B2 024E 7FB4 3D01 5474
Friedrich W. H. Kossebau
kmarkdownwebview-0.2.0.tar.xz.sig

Changes since 0.1.0

  • Markdown KIO thumbnail generator plugin added (only with QtWebKit)
  • KParts plugin: offers actions “Select All” and “Copy Text” in more places
  • KParts plugin: fixed inverted logic on text selection in context menu with QtWebEngine
  • KParts plugin: fixed install location of metadata desktop file

KTextEditorPreviewPlugin 0.1.0

KTextEditorPreviewPlugin 0.1.0 has been released.

Example: KTextEditor Document Preview plugin used with KGraphViewer KParts plugin in Kate and and with KMarkdownWebView KParts plugin in KDevelop

The KTextEditorPreviewPlugin software provides the KTextEditor Document Preview Plugin, a plugin for the editor Kate, the IDE KDevelop, or other software using the KTextEditor framework.

The plugin enables a live preview of the currently edited text document in the final format. For the display it uses the KParts plugin which is currently selected as the preferred one for the MIME type of the document. If there is no matching KParts plugin, no preview is possible.

Download from:
https://download.kde.org/stable/ktexteditorpreviewplugin/0.1.0/src

sha256:
21e17a97fe2b942991ce564371ce822564397488847f8d21d7d5b24d4c120796 ktexteditorpreviewplugin-0.1.0.tar.xz

Signed with my new PGP key
E191 FD5B E6F4 6870 F09E 82B2 024E 7FB4 3D01 5474
Friedrich W. H. Kossebau <kossebau@kde.org>
ktexteditorpreviewplugin-0.1.0.tar.xz.sig

Notes

Long term the plan is to merge this plugin into the Kate repository, or some new separate KTextEditor-Plugins repo, ideally already for KDE Applications 17.12.

For now though this plugin is in its own repository to allow an initial independent quick release cycle phase, following the release-often-and-early mantra. With the help of your feedback (file your issue) that should make the features of the plugin the ones you like to have rather soon.

Developers: Improve your favourite KParts plugin

While a usual KParts plugin works out of the box, for a perfect experience with the Automatic Updating option some further improvements might be needed:

A few KParts plugins have already seen such adaptions, like the SVGPart and the KUIViewerPart (see also blog post), adaptions to be released with KDE Applications 17.12.
Another KParts plugin has been written with that in mind from the start, the KMarkdownWebViewPart (see also blog post), which already has been released.

You might want to take some guidance by the respective commit “Support loading by stream and restoring state on reload” to the SVGPart repository.

KMarkdownWebView 0.1.0

KMarkdownWebView 0.1.0 has been released.

Example: KMarkdownWebView KParts plugin used by Ark

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).

The separate library libKMarkdownWebView is done for sharing code with a future Markdown thumbnailer plugin, whose code is not yet committed to the repository.

KMarkdownWebView can be built both with QtWebEngine (preferred by buildsystem) and QtWebKit. Pass -DUSE_QTWEBKIT=TRUE to CMake to enforce the use of QtWebKit.

Download from: https://download.kde.org/stable/kmarkdownwebview/0.1.0/src/

sha256: 361fec6c4fa9396975e788cfe759b1c45a2ccfc2b83e64b5105869ef312a5410 kmarkdownwebview-0.1.0.tar.xz

Notes

The technology behind KMarkdownWebView could be considered rather a hack, to quickly solve the need for rendering Markdown files, with the following requirements in mind:

  • webpage-like layouting (single page adapting width to screen/window size)
  • chrome-less minimalistic UI
  • support of KParts stream API (as useful with “Live Preview” plugin for KTextEditor)

Ideally this would be implemented one day natively in Qt by e.g. using QTextDocument & friends. The Markdown Okular generator gets us already closer to this, but misses all those bullet-points for now.

In-pane preview of Qt UI files with KUIViewer coming up

The “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 of existing KParts implementations out there right from the start.

A perfect user experience with the “Live Preview” plugin means:

  • automatic updates of the preview while one edits the sources, without a reset of the preview settings (scroll position, zoom state, etc.)
  • not going through the file system to push changes in the sources to the preview

For that usually some more work needs to be done to the existing KParts plugins.

Editing in the Qt UI file worlds

One of those plugins, where I also have personal interest in and thus giving priority, is the KParts plugin from the KUIViewer, a tool to display and check Qt user interface (*.ui) files. Because in the recent time I have edited Qt UI files quite often and started to do this manually directly in the XML-based sources instead of in Qt Designer, as it became quicker to do for me the more I had learned the syntax. But for checking the current state I still had to save the file and load it separately in Designer or KUIViewer.

So the KUIViewer KParts plugin and the “Live Preview” plugin for KDevelop have started to improve my developer life 🙂

“Containers” for the rescue, once more

Besides some pain points though: if you used KUIViewer yourself before, you might remember that its code was operating straight forward. For one it instantiated any UI file as-is, e.g. showed a QMainWindow-based UI also as normal separate window in the workspace, so not embedded in the window of KUIViewer itself. Which comes at least as surprise, if not as something unhandy. Especially for the use with the “Live Preview” plugin, where the automatic update of the preview and thus the reloading of the UI file in the KUIViewer code means windows coming and going all the time.
Then normal widgets were shown as main widget of the KUIViewer window, which for very big or very small widgets result in according changes to the window and broken display in the “Live Preview” plugin.

Too much pain, and then I was looking at the sources anyway. So while extending the KUIViewer KParts plugin to implement the streaming API and restoring/keeping the view state on reloading from the same URL, I also reached out for the class QMdiArea for the rescue and changed KUIViewer to show the object defined by a UI file as a subwindow instead. And that way allowing widgets to have any sizes, but also taming QMainWindow-based UI to not escape the KUIViewer scene:

This change will be coming to everyone as part of KDE Applications 17.12.

And thanks to the respective code being in the KUIViewer KParts plugin, without any further changes we get the same tamed behaviour in the “Live Preview” plugin:

Improve your favourite KParts plugin for the “Live Preview”

If you edit some other sources often and want to be supported by the “Live Preview” plugin, get and build the plugin quickly yourself, the current state works good enough.
Then see if there is a matching KParts plugin you then can improve as needed.

The “Live Preview” plugin is currently planned to be released as official part of KDE Applications 17.12 and later as well, possibly as part of the Kate repo. So a few months left to shape up your favourite KParts plugin. Go for it now to be done in time 🙂