Skip to content

Instantly share code, notes, and snippets.

@AWtnb
Last active August 25, 2025 01:52
Show Gist options
  • Select an option

  • Save AWtnb/9c3d0f54467576c0870dbde95c9bf83e to your computer and use it in GitHub Desktop.

Select an option

Save AWtnb/9c3d0f54467576c0870dbde95c9bf83e to your computer and use it in GitHub Desktop.
Cocopy custom functions

Custom functions for pokutuna/chrome-cocopy.

scrapbox

({title, url}) => `[${title.replace(/\s*[\[\]]\s*/g, ' ')} ${url}]`;

Rich text format (pastable on slack)

({ title, url }) => {
  if (url.startsWith("https://www.yuhikaku.co.jp/books/detail/")) {
    const five = url.substring(url.indexOf("9784641")).substring(7).substring(0, 5);
    title = five + "『" + title.substring(0, title.indexOf(" | ")) + "』";
  }
  return {
    html: render(`<a href="${url}">${title}</a>`),
    text: title,
  };
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment