Updated extension: Copy as Markdown

Works like before but also works on RTF and plain text selections now too. The update will be required for compatibility with Monterey 12.3, which is currently in beta.

Copy as Markdown — PopClip Extensions

Copy as Markdown

Copy web page content as Markdown source code. Also works on plain text and RTF content.

CopyAsMarkdown-demo

About

This is an extension for PopClip.

Author

Nick Moore

Requirements

Requires PopClip 2021.11.

Notes

The original extension used html2text by Aaron Swartz.

The updated JavaScript extension uses PopClip’s inbuilt markdownifier, which uses Turndown.

Hat-tip to Brett Terpstra whose Web Markdownifier extension inspired this one.

Changelog

v2 - 3 Feb 2022

  • Rewritten in JavaScript & Turndown.

v1 - 7 Dec 2016

  • Initial release (Python & html2text)

See also ’ X ’ : Extension failing (re. Copy as Markdown)

5 Likes

this is my jam. I get so much use out of this.

1 Like

@nick Thanks. Is it possible to improve the extension to make it automatically append the copied as markdown text to a certain markdown document (without pasting it manually)?

Hi @nick,

Copy as Markdown is a great feature (and the one that sold me to PopClip :slight_smile: )

Could it be possible to add it some configuration option so that it will adapt to markdown users personal preferences ?

At minimal a way to change the following defaults would be awesome

  • bulletListMarker (* to -)
  • strongDelimiter (** to __)
1 Like

Great suggestion. I’ve added these, with a few other options. See new version of the extension at Copy as Markdown — PopClip Extensions

1 Like

The updated extension is failing me.

09:52:49.4 [Copy as Markdown] performing action 'Copy as Markdown'  with input text of length 1499
09:52:49.4 [Copy as Markdown] error: TypeError: Object is not a constructor (evaluating 'new TurndownService(options)') (Config.js:53:46) <no output text>
1 Like

Thanks for reporting, I will investigate

@brokosz Confirmed not working on older versions of PopClip (I tested 2024.3.2 and 2023.9). But it works on 2024.5.2. So I think you just need to update to the latest version of PopClip.

I’ve updated the extension’s require popclip version flag accordingly.

Thanks - I thought I was up to date but will make sure.

That did it, thanks @nick. I missed the news about PopClip leaving the MAS.

1 Like

I thought that must be it. I’m sure there’s lots of people happily using the last MAS version. There’s no way for me to actually send any notification to MAS users how to update, because that would require updating the app, so it’s a bit of a chicken and egg situation. Wish I’d built something for sending “alerts” or something in advance.