]> glassweightruler.freedombox.rocks Git - xdg-ninja.git/blobdiff - xdg-ninja.sh
Normalize number of trailing newlines in markdown to 2 (#70)
[xdg-ninja.git] / xdg-ninja.sh
index e398f4a2c3113ae37e1a9b349707cadacd08653a..94a8969674fd020713e75807d5f389c37ff97f3e 100755 (executable)
@@ -98,8 +98,10 @@ check_if_file_exists() {
 }
 
 decode_string() {
-    printf "%s\n" "$1" | sed -e 's/\\n/\
-/g' -e 's/\\\"/\"/g' # Replace \n with literal newline and \" with "
+    printf "%s" "$1" | sed -e 's/\\n/\
+/g' -e 's/\\\"/\"/g' -e '$ s/\n*$/\
+\
+/' # Replace \n with literal newline and \" with ", normalize number of trailing newlines to 2
 }
 
 # Function to handle the formatting of output