How do I escape a Swift doc comment Callout?

219 Views Asked by At

I have the following doc comment in Swift:

/**
- Trace
- ↓
- Debug
- ↓
- Information
- ↓
- Warning
- ↓
- Error
*/

The line that says "Warning" does not render in Xcode because "- warning" is a keyword callout in swift doc comments. How can I escape the callout?

2

There are 2 best solutions below

0
On

You can use a zero-width space (​) before the keyword:

/**
 - Trace
 - ↓
 - Debug
 - ↓
 - Information
 - ↓
 - ​Warning
 - ↓
 - Error
 */

screenshot of rendered documentation

0
On

Not a perfect solution, but you could surround Warning with backticks (`). This will change its display style slightly:

/**
 - Trace
 - ↓
 - Debug
 - ↓
 - Information
 - ↓
 - `Warning`
 - ↓
 - Error
 */

Comments