Bug 386251 - Ability to view images in a document hierarchy like linode/docs
Summary: Ability to view images in a document hierarchy like linode/docs
Status: RESOLVED NOT A BUG
Alias: None
Product: kate
Classification: Applications
Component: plugin-preview (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-10-27 14:53 UTC by Gregor Mi
Modified: 2019-05-19 15:05 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gregor Mi 2017-10-27 14:53:06 UTC
A quite big resource of tutorials written in Markdown is this one: https://github.com/linode/docs/tree/master/docs

Images and other data is stored in an 'assets' folder. Including an image typically looks like this:

![Midnight Commander](/docs/assets/midnight_commander.jpg)

(see docs/tools-reference/tools/how-to-install-midnight-commander.md)

The root (/) is anchored at the repository root. It would be nice if the preview plugin can understand this path.

The current version (checked out 2017-10-27) of the plugin shows the default "image not found" placeholder.
Comment 1 Friedrich W. H. Kossebau 2017-10-27 16:39:04 UTC
Two separate challenges here:

first one is that the KParts plugin, which shows the current text document, does not get a url pointing to the file on the storage system currently bound to the loaded document (e.g. a path on the local filesystem). But, in case the KParts plugin supports the KParts Push API, a custom url representing the source of the data, which is the working memory model of the document (with all its current data, which might be different from the version in the storage or not even there yet).
Or it gets the url to a temporary file used as buffer to pass the data to KParts plugin which do not support the Push API.
So any relative path in the document shown by the KParts plugin are on a wrong base, the KParts plugin itself does not know this though (and the API does not have support yet for instructing some url rewriting).

The second challenge, though related, is to add support for custom path rewriting (or perhaps even auto-detection of such a need), so one could instruct the KParts plugin somehow how to rewrite relative urls.

No idea yet.

Having said all that...

Possibly one would be better off by creating a custom Markdown editor application, based on KTextEditor lib and all the Kate plugins, and instead of relying on the preview plugin and the KMarkdownWebView KParts plugin and the rather simple, generic API which they are limited to, rather write custom code which then gives all kind of flexibility and access to internals to achieve the desired goals.

Such a KMarkdownEdit app could have its own Markdown parser, perhaps based on that lib also used by the Okular Markdown plugin, to generate a central Markdown document model which then powers both the syntax highlighting, the rendering and other things like TOC. And by also having control about fetching external resources, like images, path/url rewriting would also be more easily done.

A swiss army knife is nice and useful in general, but for cutting bread using a dedicated knife is nicer :)
Comment 2 avlas 2017-11-15 19:41:16 UTC
Another example of this, in addition to markdown files, are previews of html files. It would be great if this would be managed. This would boost Kate for developing webs...

Ideally, dedicated applications are the best (also to have a bunch of other potential features), but that requires motivated devs creating and maintaining those applications. There are no many actively maintained apps like this right now (I think Kile would be an exemption).

I think the benefit and potential of doing this in Kate's preview is to have a centralized code from which all kpart plugins can benefit. And besides the technical issues, which I'm sure are complicated to manage, I think that adding embedded images in a preview is kind of a basic thing to have.
Comment 3 Christoph Cullmann 2019-05-19 15:05:51 UTC
Dear user, this wish list item is now closed, as it wasn't touched in the last year and no contributor stepped up to implement it.

The Kate/KTextEditor team is small and we can just try to keep up with fixing bugs.

Therefore wishes that show no activity for a years or more will be closed from now on to keep at least a bit overview about 'current' wishs of the users.
If you want your feature to be implemented, please step up to provide some patch for it.

If you think it is really needed, you can reopen your request, but keep in mind,
if no new good arguments are made and no people get attracted to help out to implement it,
it will expire in a year again.

We have a nice website https://kate-editor.org that provides all the information needed to contribute, please make use of it.

Patches can be handed in via https://phabricator.kde.org/differential/

Greetings
Christoph Cullmann