Skip to content

Commit a33aed0

Browse files
ChristopherRogersjrose-apple
authored andcommitted
[PrintAsObjC] Inline code segments in documentation should remain inline. (#6625)
Fixes <https://bugs.swift.org/browse/SR-3163>.
1 parent 3bdada1 commit a33aed0

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

lib/IDE/CommentConversion.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -595,11 +595,9 @@ class DoxygenConverter : public MarkupASTVisitor<DoxygenConverter> {
595595
}
596596

597597
void visitCode(const Code *C) {
598-
print("\\code");
599-
printNewline();
598+
print("<code>");
600599
print(C->getLiteralContent());
601-
printNewline();
602-
print("\\endcode");
600+
print("</code>");
603601
}
604602

605603
void visitHTML(const HTML *H) {

test/PrintAsObjC/Inputs/comments-expected-output.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,7 @@ SWIFT_CLASS("_TtC8comments19HasThrowingFunction")
235235
236236
237237
throws:
238-
An error if \code
239-
x == 0
240-
\endcode
238+
An error if <code>x == 0</code>
241239
*/
242240
- (void)f1:(NSInteger)x;
243241
- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
@@ -299,9 +297,7 @@ SWIFT_CLASS("_TtC8comments20IndentedBlockComment")
299297
SWIFT_CLASS("_TtC8comments10InlineCode")
300298
@interface InlineCode
301299
/**
302-
Aaa \code
303-
bbb
304-
\endcode ccc.
300+
Aaa <code>bbb</code> ccc.
305301
*/
306302
- (void)f0;
307303
- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;

0 commit comments

Comments
 (0)