Modify selected text with preceding bullet?

I’d like to selected a line or two of text and have Popclip add an asterisk and space to the beginning of each line so that Markdown treats it as an unordered list.

I would use this mostly within DEVONthink to modify text items.

Thanks!

2 Likes

Love this. I would use it too.

Of course, it would be nice to create an ordered list (1, 2, 3, etc) as well.

# popclip (maybe you need to change the icons 😂)
name: Markdown List
icon: ML
actions:
  - title: Begin with Number
    icon: text:123
    javascript: return '1. ' + popclip.input.text.replace(/\n/g, '\n1. ')
    after: paste-result
  - title: Begin with Dot
    icon: text:...
    javascript: return '- ' + popclip.input.text.replace(/\n/g, '\n- ')
    after: paste-result
2 Likes

The extension is ready to download.

This is wonderful! Can you make it so that it copies that text and link in Markdown? Nick made the following, and it would be wonderful to have your features of making a list…

popclip extenison to copy markdown with source link

name: MD Copy with Link
icon: symbol:link.circle.fill
capture html: true
javascript: |
let text = popclip.input.markdown
if (popclip.context.browserUrl.length > 0) {
text += ‘\n\n[’ + popclip.context.browserTitle + ‘](’ + popclip.context.browserUrl + ‘)’
}
popclip.copyText(text)

I’m not quite sure if the below is what you want

# popclip
name: Markdown List
icon: symbol:list.star
capture html: true
actions:
  - title: Numbered List
    icon: symbol:list.number
    javascript: |
      popclip.copyText('1. ' + popclip.input.markdown.replace(/\n/g, '\n1. '))
  - title: Bulleted List
    icon: symbol:list.bullet
    javascript: |
      popclip.copyText('- ' + popclip.input.markdown.replace(/\n/g, '\n- '))

Yes, everything is great, including turning the links into markdown in the content being copied… the thing I am looking for is the markdown link at the end for the URL of the source.

Nick already did this, but he didn’t have the listing elements you have added. Here is Nick’s:

Like this?

# popclip
name: Markdown List
icon: symbol:list.star
capture html: true
actions:
  - title: Numbered List
    icon: symbol:list.number
    javascript: |
      popclip.copyText('1. ' + popclip.input.markdown.replace(/\n/g, '\n1. ') + (popclip.context.browserUrl.length > 0 ? ' [' + popclip.context.browserTitle + '](' + popclip.context.browserUrl + ')' : ''))
  - title: Bulleted List
    icon: symbol:list.bullet
    javascript: |
      popclip.copyText('- ' + popclip.input.markdown.replace(/\n/g, '\n- ') + (popclip.context.browserUrl.length > 0 ? ' [' + popclip.context.browserTitle + '](' + popclip.context.browserUrl + ')' : ''))
1 Like

Oh baby yes!! One last little detail… if the URL link at the end is connected at the end of the content instead of on the next line.

Wow, this will be such a great tool. Thanks for your work on this!!!

Stan

So it would look like this…

Ok, updated, try to reinstall the script :wink:

Which is the updated version?

Perfect!!! Thank you so much! This is an amazing tool!

Post #8 is the one…

great work everyone! :clap:

It is the first of the two attachments above… Thanks Nick for all your work on this!! Stan