leading and trailing white space (equiv. of strip() in python)
    result = result.trim();

    // cloze deletion replacing bold with [...]
    if (typeof isClozeDeletion !== "undefined" && isClozeDeletion) {
      result = result.replace(/<b>.*?<\/b>/g, "<b>[...]</b>");
    }

    // removes newlines

    // removes the final period if exists
    if ((getSetting(['modules','sent-utils','remove-final-period',],true) && !isAltDisplay)
      || (getSetting(['modules','sent-utils','remove-final-period-on-altdi