Skip to content

Commit 8adc178

Browse files
authored
Markdown examples in formatter preview samples (#2616)
Adds a markdown javadoc snippet for showcasing formatter support for Markdown comments Fixes : #2545
1 parent a5048d7 commit 8adc178

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

org.eclipse.jdt.ui/preview/formatter.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2018, 2024 Mateusz Matela and others.
2+
* Copyright (c) 2018, 2025 Mateusz Matela and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -1183,6 +1183,22 @@ interface Example {
11831183
* <ul><li>Formatting of header comments.</li><li>Formatting of Javadoc tags</li></ul>
11841184
*/
11851185
int bar2(); // This is a long comment that should be split in multiple line comments in case the line comment formatting is enabled
1186+
1187+
1188+
/// The following is some sample code which illustrates source formatting within markdown comments. Descriptions of parameters and return values are best appended at end of the markdown comment.
1189+
/// * Method Overview
1190+
/// 1. Description
1191+
/// * Performs a calculation using two integer inputs
1192+
/// - Ensures the first input is an odd number between 0 and 100
1193+
/// 2. Behavior
1194+
/// * Returns an even integer between 0 and 1000
1195+
/// - Throws an exception if inputs are invalid or computation fails
1196+
/// @param first The first parameter. For an optimum result, this should be an odd number between 0 and 100.
1197+
/// @param second The second parameter.
1198+
/// @throws Exception when the foo operation cannot be performed for one reason or another.
1199+
/// @return The result of the foo operation, usually an even number within 0 and 1000.
1200+
int foo2(int first, int second) throws Exception;
1201+
11861202
/**
11871203
* The following is some sample code which illustrates source formatting within javadoc comments:
11881204
* <pre>public class Example {final int a= 1;final boolean b= true;}</pre>

0 commit comments

Comments
 (0)