code: func (r *RenderTemplateResult) compressHtml(b *bytes.Buffer) (b2 *bytes.Buffer) {
  
  	// Allocate length of original buffer, so we can write everything without allocating again
  	b2.Grow(b.Len())
  	insidePre := false
  	for {
  		text, err := b.ReadString('\n')
  		// Convert to lower case for finding <pre> tags.
  		tl := strings.ToLower(text)
  		if strings.Contains(tl, "<pre>") {
  			insidePre = true
  		}
  		// Trim if not inside a <pre> statement
  		if !insidePre {
  			// Cut trailing/leading whitespace
  			text = strings.Trim(text, " \t\r\n")
  			if len(text) > 0 {
  				if _, err = b2.WriteString(text); err != nil {
  					resultsLog.Error("Apply: ", "error", err)
  				}
  				if _, err = b2.WriteString("\n"); err != nil {
  					resultsLog.Error("Apply: ", "error", err)
  				}
  			}
  		} else {
  			if _, err = b2.WriteString(text); err != nil {
  				resultsLog.Error("Apply: ", "error", err)
  			}
  		}
  		if strings.Contains(tl, "</pre>") {
  			insidePre = false
  		}
  		// We are finished
  		if err != nil {
  			break
  		}
  	}
  
  	return
  }
docs: // Trimming the HTML will do the following:
  // * Remove all leading & trailing whitespace on every line
  // * Remove all empty lines
  // * Attempt to keep formatting inside <pre></pre> tags
  //
  // This is safe unless white-space: pre; is used in css for formatting.
  // Since there is no way to detect that, you will have to keep trimming off in these cases.