How to mark code snippet in Headerdoc?
Asked Answered
F

5

7

I usually need to write many short code in code comment like this. Is this possible to use in Apple's Headerdoc? Because this type of code notation is generally used heavily, so i believe there's a convenient way to do this instead of marking HTML tags.

Fiji answered 8/11, 2011 at 0:27 Comment(0)
F
1

I ended up with using @c.

This is an example @c code-style text.
Fiji answered 24/12, 2014 at 0:4 Comment(0)
C
6

You need to format a block of code use: @code &@endcode tags like:

/**
 * @code
 * [myObj myMethod];
 * @endcode
 */

If you want to format a single word @c is enough, like:

/**
 * @c is enough
 */
Creationism answered 23/12, 2014 at 22:20 Comment(0)
T
4

Within your HeaderDoc, you can use this formatting:

 @code
// code text
while (someCondition) {
    NSLog(@"Hello");
    doSomething();
}@endcode
 Last line text.

Source: https://mcmap.net/q/127890/-what-are-the-new-documentation-commands-available-in-xcode-5-closed

Thebes answered 21/5, 2014 at 18:58 Comment(1)
It doesn't seem to work: Unknown field type @code in HeaderDoc comment.Banville
F
1

I ended up with using @c.

This is an example @c code-style text.
Fiji answered 24/12, 2014 at 0:4 Comment(0)
B
1

@code and @c don't seem to work as of Headerdoc 8.9. I ended up using:

<pre>@textblock
@/textblock</pre>
Banville answered 23/7, 2015 at 11:21 Comment(1)
For whom seeking for the right answer. This your answer.Sharl
C
1

I'm on Xcode 6.4/HeaderDoc 8.9 and neither @code nor @c work. <pre>code</pre> works but adds newlines.

I ended up being able to produce inline code snippets by using <tt>code</tt> (teletype text).

Chromatography answered 21/8, 2015 at 4:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.