benblack86 / linkclump

Google chrome extension that allows you to open multiple links at once.
MIT License
493 stars 115 forks source link

Feature request: Custom link copy formats #235

Closed sullyj3 closed 7 months ago

sullyj3 commented 7 months ago

Hi there, thanks for the extension!

I have a feature request, which I'd be happy to implement and PR. I thought I'd check what you thought of the idea and my proposed design before spending time implementing it.

I was wanting the option for linkclump to support copying space separated URLs only. The motivation is that this would be easier to paste into the command-line, eg as arguments to wget.

I had a look at the code

"copy": {
    "name": "copy format",
    "type": "selection",
    "data": ["URLS with titles", "URLS only", "titles only", "as link HTML", "as list link HTML", "as Markdown"],
    "extra": "format of the links saved to the clipboard"
    },

If we were to add eg "URLs only space separated" that feels a bit specific and ad-hoc. It feels like just adding an extra option for each new desired format is going to lead to a proliferation of choices.

One solution could be to allow users to specify a simple custom format in a textbox using variables for the url and title. This would subsume all previous options and provide more flexibility:

And I could just use %url% for my space separated urls.

The obvious wrinkle is "as list link HTML", which additionally requires the opening and closing <ul><\ul>. One possibility would be to additionally have an option for the overall format of all links, with %links% standing in for the concatenation of all the formatted links. Then "as list link HTML" would be <ul>\n%links%<\ul>\n and all other existing options would just be %links%. And %links% could just be the default if case of no input.

To make this more convenient for users, we could keep the existing options in the form of buttons that prefill the format textbox with their corresponding formats. Then users can easily customise the default options to their liking.

Additionally, the UI could provide a preview window for immediate feedback as the user types:

link format textbox: === %title% === %url% ===\n
links format textbox: TOP\n%links%BOTTOM

preview window: 
TOP
=== Example Domain === https://www.example.com ===
=== Google === https://www.google.com ===
BOTTOM

What do you think?

benblack86 commented 7 months ago

I think making it customizable would be great, but doing it well without making it too complicated for the user would be a lot of work. I'm fine with you adding "URLs only space separated" option.

I don't know if Linkclump will survive the migration to manifest v3 as I might not have time to do the work so that is something else to consider before doing a PR.