code: function trimLinesRight(string) {
                  // Replace all empty lines with just a newline
                  // Remove all trailing spaces
                  return string.replace(/^\s*$/gm, "").replace(/^(.*[^\s])( *)$/gm, function (unused, content) {
                      return content;
                  });
              }
docs: Templates