diff --git a/tools/doc-generator/doclet/src/main/java/org/projectnessie/nessie/docgen/MarkdownFormatter.java b/tools/doc-generator/doclet/src/main/java/org/projectnessie/nessie/docgen/MarkdownFormatter.java index 4733c09ca12..0a44c6deb68 100644 --- a/tools/doc-generator/doclet/src/main/java/org/projectnessie/nessie/docgen/MarkdownFormatter.java +++ b/tools/doc-generator/doclet/src/main/java/org/projectnessie/nessie/docgen/MarkdownFormatter.java @@ -258,6 +258,13 @@ void maybeAddSeparator() { } text.append(' '); } + + void trimRight() { + int l = text.length(); + while (l > 0 && Character.isWhitespace(text.charAt(l - 1))) { + text.setLength(--l); + } + } } private class MDFormat { @@ -491,9 +498,11 @@ private void process(DocTree doc) { break; case "em": case "i": + target.trimRight(); target.text.append('_'); break; case "b": + target.trimRight(); target.text.append("**"); break; case "ol":