docs: private static String cleanSoyDocHelper(String soyDoc) {
      // Change all newlines to "\n".
      soyDoc = NEWLINE.matcher(soyDoc).replaceAll("\n");
  
      // Escape all @deprecated javadoc tags.
      // TODO(cushon): add this to the specification and then also generate @Deprecated annotations
      soyDoc = soyDoc.replace("@deprecated", "&#64;deprecated");
  
      // Strip start/end tokens and spaces (including newlines if they occupy their own lines).
      soyDoc = SOY_DOC_START.matcher(soyDoc).replaceFirst("");
      soyDoc = SOY_DOC_END.matcher(soyDoc).replaceFirst("");
  
      // Split into lines.
      List<String> lines = Lists.newArrayList(Splitter.on(NEWLINE).split(soyDoc));
  
      // Remove indent common to all lines. Note that SoyDoc indents often include a star
      // (specifically the most common indent is space-star-space). Thus, we first remove common
      // spaces, then remove one common star, and finally, if we did remove a star, then we once again
      // remove common spaces.
      removeCommonStartCharHelper(lines, ' ', true);
      if (removeCommonStartCharHelper(lines, '*', false) == 1) {
        removeCommonStartCharHelper(lines, ' ', true);
      }
  
      return CharMatcher.whitespace().trimTrailingFrom(Joiner.on('\n').join(lines));
    }