yorkxin / copy-as-markdown

A browser extension to copy tabs and links as Markdown
MIT License
528 stars 81 forks source link

Provide an option for Link copy format #12

Open yorkxin opened 12 years ago

yorkxin commented 12 years ago

i.e. Let user choose whether the link is formatted as

[Text](url)

or

[Text][id]

[id]:url
the-solipsist commented 9 years ago

This feature would be very welcome!

malcook commented 8 years ago

if you do this:

another useful format is that of org-mode, which is [[url][text]]

and another is as html link(s)

tohagan commented 8 years ago

Ideally I think you'd allow the user to create custom link styles. One solution would be to allow a user to create one or more named link styles (Markdown, Dockuwiki, MediaWiki, HTML ... whatever) and then define a link text template for each style ...

The user would then select this named style when they copy a link.

Users like me are likely to want to frequently use all the different link styles at different times and so be able to quickly choose the link format when I copy a link (not have to navigate inside the extension options to re-select a link style every time). So if you added this I'd make the link styles names appear on the link menu that appears when you perform the link copy. They could appear be a "checked" menu option that does not close the menu.

So your menu might be ...

The options can be hidden if only one style (Markdown) is defined.

yorkxin commented 8 years ago

@tohagan Thank you for your suggestion. In fact I sometimes also have need to copy links in non-Markdown format e.g. RTF, in order to paste to rich text editors like Dropbox Paper. I think the UI you proposed is simple and easy to understand. I will consider working on this feature :)

tohagan commented 8 years ago

Thanks very much :+1: I think it will be a really valuable addition and hopefully not that hard to code

sebastienbarre commented 7 years ago

This looks great. At this point you are one of the only Copy Link extensions that is multiprocess. Ideally I would love for it to do everything the CoLT extension used to do (especially the "Copy Link Text" menu item, which copies a hyperlink's associated text to the clipboard).

keisuke-nakata commented 6 years ago

Recent Firefox update destroyed almost all plugins which provide "copy link as something", except for this plugin. Supporting "copy link as HTML, or any format you specify" feature is very helpful for Firefox users.

sgourichon commented 6 years ago

Another overnight-obsoleted extension is Easy Copy.

Easy Copy has been on my shortlist of best extensions for years

It has a simple yet very flexible configuration system which basically allows you to generated whatever markup language you need, while supporting many uses cases. Examples:

Screenshots

use

configuration

Conclusion

jmfayard commented 4 years ago

Hello @chitsaou Just wanted to say that i like your plugin a lot. Do you have plans to implement this feature? That would make it instantly 2 times better.

Please add as well Asciidotor format: http://example.com[Title of the webpage]

bhrutledge commented 4 years ago

Thanks for this extension! I frequently use it to copy a bunch of tabs into my Markdown notes. However, I prefer - over * for my list bullets. Can that be added as an option?

Expected Behavior

Set a preference for list bullet to -, then "All tabs link" or "Selected tabs link" would copy:

- [chitsaou/copy-as-markdown: Copying Link, Image and Tab(s) as Markdown Much Easier.](https://github.com/chitsaou/copy-as-markdown)
- [Copy as Markdown - Chrome Web Store](https://chrome.google.com/webstore/detail/copy-as-markdown/fkeaekngjflipcockcnpobkpbbfbhmdn?hl=en)
- [Copy as Markdown – Get this Extension for 🦊 Firefox (en-US)](https://addons.mozilla.org/en-US/firefox/addon/copy-as-markdown/)

Actual Behavior

* [chitsaou/copy-as-markdown: Copying Link, Image and Tab(s) as Markdown Much Easier.](https://github.com/chitsaou/copy-as-markdown)
* [Copy as Markdown - Chrome Web Store](https://chrome.google.com/webstore/detail/copy-as-markdown/fkeaekngjflipcockcnpobkpbbfbhmdn?hl=en)
* [Copy as Markdown – Get this Extension for 🦊 Firefox (en-US)](https://addons.mozilla.org/en-US/firefox/addon/copy-as-markdown/)
roryokane commented 2 years ago

Like @bhrutledge, I would prefer my copied text use - as the list bullet instead of *. I don’t have time right now to try to edit this extension, but here are some notes towards developing that feature.

This is the function that writes * as the list bullet:

https://github.com/yorkxin/copy-as-markdown/blob/e990a320697486108504d88ddee7d676eac8abb9/src/background/markdown.js#L38-L40

The simplest edit to that file that would support customizing the list bullet and nothing else might be this:

export function list(theList) {
  const bulletCharacter = userOptions.bulletCharacter || '*';
  return theList.map((item) => `${bulletCharacter} ${item}`).join('\n');
}

Then src/lib/options-manager.js would need to be edited to support storing a bulletCharacter option, and src/ui/options.js and src/ui/options.html would have to be edited to support the user editing that option. The editing interface would be either radio buttons or a pop-up menu. The buttons or menu would have two options: * and -.

The template-based customization feature described in tohagan’s comment sounds more useful than just being able to customize the bullet character, and it would solve my problem. However, it sounds more complicated to implement.

roryokane commented 2 years ago

As an alternative to adding an bullet customization option as I described above, we could change the hard-coded bullet character from * to - by editing the list function. Do any current users of the extension (including its author) actively prefer * over -, or was * an arbitrary choice? I prefer - for various reasons, including that it matches Prettier’s Markdown formatting.

yorkxin commented 4 months ago

Related: #98

edrex commented 1 week ago

Thanks for maintaining this extension for so long yorkxin :heart:

I go back and forth between org-mode and markdown, and as others have noted (@tohagan @malcook back in 2016) there are a few other text-based formats in use. A custom format option with a template field would be great. Concat multiple with newlines. Otherwise we could just add the requested formats, but it would make the options more overwhelming for the large majority of users. Since I need this I'll have a go and PR if that's cool.

yorkxin commented 1 week ago

Hi @edrex (and everyone), I understand this feature has been long asked for, ever since the birthday of this extension.

I have a prototype of custom formats, but I am trying to make it as simple as possible, so that people who are not tech-savvy don't get scared. This requires some UX design efforts. I am working with a UX designer to figure it out.

Meanwhile, I'll explore some options and see if I can ship a simplest version.

Thanks for your patient!