Plugin: Remove Carriage Returns

Name

Remove Carriage Returns

Description

This is a simple plugin that allows you to select text within one of your notes and remove carriage returns from the text. This is a common problem when copying text over from a PDF and pasting into a note or document.

Icon

find_replace

Instructions

Highlight the text you copied over from a PDF. Then click "Remove carriage returns" from the context menu. The plugin adds a space at the end of each line to ensure words are separated, but note that sometimes you'll get the wrong result if the last character on a line is a hyphen (-) for example.


The text is then transformed -->


{
replaceText(app, selectedText) {
let replaceRegex = /\r?\n|\r|\n|\u2028|\u2029/g;
let newString = selectedText.replace(replaceRegex, ' ');
return newString;
}
}