private static String toHTMLWithLineWrappingAndEncoding(String text, int maxLineLength,
			boolean preserveLeadingWhitespace) {

		StringBuilder buffy = new StringBuilder();
		List<String> lines = HtmlLineSplitter.split(text, maxLineLength, preserveLeadingWhitespace);
		for (int i = 0; i < lines.size(); i++) {
			String line = lines.get(i);
			buffy.append(friendlyEncodeHTML(line, !preserveLeadingWhitespace));

			if (i + 1 < lines.size()) {
				// don't add to the end
				buffy.append(BR).append('\n');
			}
		}

		String html = wrapAsHTML(buffy.toString());
		return html;
	}
A convenience method to split the given HTML into lines, based on the given length, and
then to {@link #friendlyEncodeHTML(String)} the text.

<P>This method preserves all whitespace between line breaks.

<P><B>Note: </B>This method is not intended to handle text that already contains
entity escaped text.  The result will not render correctly as HTML.

@param text the text to update
@param maxLineLength the max line length upon which to wrap; 0 for no max length
@return the updated text
Ghidra/Framework/Gui/src/main/java/ghidra/util/HTMLUtilities.java