Skip to content

Commit 7616659

Browse files
committed
Change 2
1 parent 3cd8103 commit 7616659

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/CommentsPreparator.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,7 @@ private void handleMarkdown(TagElement node) {
843843

844844
List<ASTNode> fragments = node.fragments();
845845
ArrayDeque<ASTNode> fragmentsDeque = new ArrayDeque<>(fragments);
846-
handleMarkdownList(fragmentsDeque, 1, 0, null);
846+
handleMarkdownList(fragmentsDeque, this.markdownLeadingSpaces, 0, null);
847847
handleMarkdownTable(fragments);
848848

849849
matcher = MARKDOWN_FENCES_PATTERN.matcher(text); // Check for Markdown snippet with styles '``` & ```'
@@ -991,10 +991,10 @@ private boolean handleMarkdownIndentedCodeBlock(ArrayDeque<ASTNode> fragments, i
991991
firstTokenIndex++;
992992
firstToken = this.ctm.get(firstTokenIndex);
993993
fragmentIndent = this.ctm.getLength(indentBase, firstToken.originalStart - 1, 0);
994-
indentDiff = fragmentIndent - srcIndent;
994+
indentDiff = fragmentIndent - srcIndent - 1; // somehow indent threshold is 1 higher in lists
995995
}
996996

997-
if (indentDiff > 4 && (firstToken.getLineBreaksBefore() > 1 || isListItem)) {
997+
if (indentDiff >= 4 && (firstToken.getLineBreaksBefore() > 1 || isListItem)) {
998998
codeBlockStartIndex = firstTokenIndex;
999999
firstToken.setAlign(this.markdownLeadingSpaces + fragmentIndent - 1);
10001000
} else {

0 commit comments

Comments
 (0)