Skip to content

Commit

Permalink
ShareInto: Only trim line breaks when appending, by @gsantner, closes #…
Browse files Browse the repository at this point in the history
…1526

example keep Markdown double spaces
  • Loading branch information
gsantner committed Dec 8, 2021
1 parent 840d9f5 commit 30ca799
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ private void appendToExistingDocument(final File file, final String separator, f
final String shareIntoFormat = ShareUtil.formatDateTime(context, _appSettings.getShareIntoPrefix(), System.currentTimeMillis());
final boolean isTodoTxt = TextFormat.CONVERTER_TODOTXT.isFileOutOfThisFormat(file.getAbsolutePath());

final String newContent = document.loadContent(context).trim()
final String newContent = document.loadContent(context).replaceAll("(?m)^[\\r\\n]+|[\\r\\n]+$", "")
+ separator
+ (isTodoTxt ? _sharedText : formatOrPrefixSharedText(shareIntoFormat, _sharedText));
document.saveContent(context, newContent);
Expand Down

0 comments on commit 30ca799

Please sign in to comment.