Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to add space between link url and brackets #236

Closed
JuanIrache opened this issue Sep 27, 2021 · 6 comments
Closed

Option to add space between link url and brackets #236

JuanIrache opened this issue Sep 27, 2021 · 6 comments

Comments

@JuanIrache
Copy link

Problem to solve
Some browsers or email clients are interpreting the closing ] bracket of a link as part of the url

What works
You can remove brackets, but I'd rather have them

What is missing
There's no option to leave brackets on but add a space between them and the link

How the missing feature should be implemented
An option like noLinkBrackets

@KillyMXI
Copy link
Member

Hmm. There is a valid point here, when dealing with real-world systems.
But at the same time this request looks terribly specific (for the lack of a better word).

Existing formatter looks quite bad already from the amount of customizations.

As a workaround, you can take it as a base for your custom formatter right now (see Readme section).

I'll think about a nicer way to customize the link format compared to another boolean option.
There are one or two legacy options elsewhere in built-in formatters that are rather arbitrary and I'm trying to not introduce more. It must be pretty universal, otherwise a custom formatter is the way to go.

@JuanIrache
Copy link
Author

Thank you. That makes sense.

I guess another solution would be adding spaces between urls and brackets by default. I do get clicks on links ending in ] quite often

@KillyMXI
Copy link
Member

I think I will deprecate noLinkBrackets and allow to provide bracket strings instead.

@KillyMXI
Copy link
Member

KillyMXI commented Nov 7, 2021

With version 8.1.0 you can now specify bracket strings for links and images:

{
  selectors: [
    { selector: 'a', options: { linkBrackets: ['[ ',' ]'] } },
    { selector: 'img', options: { linkBrackets: ['[ ',' ]'] } }
  ]
}

@KillyMXI KillyMXI closed this as completed Nov 7, 2021
@webstech
Copy link
Contributor

With version 8.1.0 you can now specify bracket strings for links and images

@KillyMXI Curious as to why this is an array and not { "[", "]" }, which could be uniquely typed.

@KillyMXI
Copy link
Member

KillyMXI commented Feb 23, 2022

@webstech I haven't spent much time considering the options, honestly.
Below are partly old and partly current considerations:

  • using literal [ and ] keys inside linkBrackets didn't cross my mind. It seems clever but I'm not completely sure it's the best idea;
  • any other names would take more space than it deserves. And the naming is hard, meaning there are even more fuel for the paralysis of choice;
  • another level of nesting is not good. I'm not quite happy with the current situation already;
  • I thought about separate leftBracket and rightBracket keys for left and right bracket directly in the options object. I think it is the most sensible alternative, but I decided I don't like to separate an inseparable entity, in addition for it being mouthful;
  • using [ and ] keys directly inside options object seems to me like a really bad idea, something doubly unexpected, clever in a bad way.
  • array serves as a poor man's tuple in a situation where the number and the ordering of items rather obvious, and it allows to not invent extra names. So it just felt least bad for me.

Thinking about it now, after implementing the new CLI (not public yet), every extra non-word characters you'd have to type in command line can become a source of issues as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants