Is there a script to remove tags from the clipboard?

Hi there,
I’m all new to TaskPaper, and I try to use it for meeting minutes. For that purpose I use Markdown syntax, tags and searches to have text ready to paste into an editor for sending sending out properly formatted minutes and follow-up overviews to participants.

For time being, I use the shortcut process of cmd+A->Remove tags->copy->paste into editor->Return to TP document->undo). It feels a bit shaky, is there an easy way to copy/export a selection without the tags? Thanks for any help.

This script will copy the visible selected items to the clipboard without tags:

var TaskPaper = Application('TaskPaper')

function TPContextCopyWithoutTags(editor, options) {
  var selection = editor.selection;
  var selectedItems = selection.displayedSelectedItems;
  var selectedItemsClones = selectedItems.map(function(each) { return each.clone(false) });

  selectedItemsClones.forEach(function(each) {
    each.attributeNames.forEach(function(eachAttributeName) {
	  if (eachAttributeName != 'data-type' && eachAttributeName.indexOf('data-') == 0) {
        each.removeAttribute(eachAttributeName)
      }
    })
  });
  
  return ItemSerializer.serializeItems(selectedItemsClones, { type: ItemSerializer.TaskPaperType });
}

var selectionWithoutTags = TaskPaper.documents[0].evaluate({
  script: TPContextCopyWithoutTags.toString(),
  withOptions: { }
});

TaskPaper.includeStandardAdditions = true
TaskPaper.setTheClipboardTo(selectionWithoutTags)
2 Likes