alexherbo2 / krabby

A keyboard interface to the web, inspired by Kakoune
https://krabby.netlify.app
The Unlicense
311 stars 20 forks source link

Add an external filter to the yank commands #5

Closed alexherbo2 closed 4 years ago

alexherbo2 commented 4 years ago

I’m currently playing with Surfingkeys, as suggested by @AdamWagner in Scroll – #1.

One of its features I’m really impressed by is its y (m) c command to yank one or multiple columns in a table.

It is already possible in Krabby, because it shines for selecting elements at their structural (DOM) level, but it is clearly not as straightforward as in Surfingkeys.

Issues with the command

The feature is a one-shot, and not very composable; it is unclear to me to decide what to yank: do we want the text content, links, something else? In either way, the inner structure is lost.

What to do on Krabby’s side

We can add a context for tables, and map y to the following actions:

Be more generic

Why restricting the feature to tables. How about adding a page level context (when <body> is selected), and move inside y to yank the page address and description (currently, these two commands belong to the Command context), and in the Command context, yank the Markdown and raw representation of the selections.

What prevent me to do it is I’m not fond of including custom libraries in the base project.

Another possibility is to have y to always yank the HTML representation, with an external filter, so we can use Pandoc (configurable), and Alt + y to do the same, but without the filtering (the raw version).

Using an external filter has the nice add to not enforce Markdown output (which is currently the case for Y commands).