|
| 1 | +{ |
| 2 | + "id": 92, |
| 3 | + "slug": "markdown-javadoc-comments", |
| 4 | + "title": "Markdown in Javadoc comments", |
| 5 | + "category": "language", |
| 6 | + "difficulty": "beginner", |
| 7 | + "jdkVersion": "23", |
| 8 | + "oldLabel": "Java 8", |
| 9 | + "modernLabel": "Java 23+", |
| 10 | + "oldApproach": "HTML-based Javadoc", |
| 11 | + "modernApproach": "Markdown Javadoc", |
| 12 | + "oldCode": "/**\n * Returns the {@code User} with\n * the given ID.\n *\n * <p>Example:\n * <pre>{@code\n * var user = findUser(123);\n * }</pre>\n *\n * @param id the user ID\n * @return the user\n */\npublic User findUser(int id) { ... }", |
| 13 | + "modernCode": "/// Returns the `User` with\n/// the given ID.\n///\n/// Example:\n/// ```java\n/// var user = findUser(123);\n/// ```\n///\n/// @param id the user ID\n/// @return the user\npublic User findUser(int id) { ... }", |
| 14 | + "summary": "Write Javadoc comments in Markdown instead of HTML for better readability.", |
| 15 | + "explanation": "Java 23 introduces /// Markdown-style Javadoc comments as an alternative to the traditional /** */ HTML-based format. Markdown syntax is more natural to write and read, with support for code blocks, emphasis, lists, and links. The compiler converts Markdown to HTML for javadoc output.", |
| 16 | + "whyModernWins": [ |
| 17 | + { |
| 18 | + "icon": "📖", |
| 19 | + "title": "Natural syntax", |
| 20 | + "desc": "Use backticks for inline code and ``` for blocks instead of HTML tags." |
| 21 | + }, |
| 22 | + { |
| 23 | + "icon": "✍️", |
| 24 | + "title": "Easier to write", |
| 25 | + "desc": "No need for {@code}, <pre>, <p> tags — just write Markdown." |
| 26 | + }, |
| 27 | + { |
| 28 | + "icon": "👁", |
| 29 | + "title": "Better in editors", |
| 30 | + "desc": "Markdown renders beautifully in modern IDEs and text editors." |
| 31 | + } |
| 32 | + ], |
| 33 | + "support": { |
| 34 | + "state": "available", |
| 35 | + "description": "Available since JDK 23 (Sept 2024)" |
| 36 | + }, |
| 37 | + "prev": "language/default-interface-methods", |
| 38 | + "next": "language/static-methods-in-interfaces", |
| 39 | + "related": [ |
| 40 | + "language/text-blocks-for-multiline-strings", |
| 41 | + "language/records-for-data-classes", |
| 42 | + "language/type-inference-with-var" |
| 43 | + ] |
| 44 | +} |
0 commit comments