Jeef
Jeef

Reputation: 27275

Swift 1.2 Documentation Changes (Markdown Support)

I just upgraded to Xcode 6.3 and it has the Swift 1.2 support. I was loading quick documentation in a swift file for the description variable as part of the Printable protocol.

I noticed that the documentation has a nice little inline code block. I'm as of yet unsure if this was there in the previous version of swift and whether it is "special" or they've added more support for features for inline documentation.

Anybody aware of how to do this for my own quick-help?

enter image description here

I believe Obj-c documentation has much more "features" and perhaps as this is part of an Objc protocol thats why the documentation is "fancy"

Update the following:

/** 

Test Protocol Definition

    Code Block

**BOLD**


*/

Renders as:

enter image description here

Upvotes: 1

Views: 1389

Answers (1)

Jeef
Jeef

Reputation: 27275

So after some "sleuthing" the closest I could come to for an answer was at: https://developer.apple.com/swift/blog/?id=24

Stylized text is easy to add to your playground by adding special markup to your comments based on the familiar Markdown syntax. Some available styles are headings, bold, italic, lists, bullets, and links to external or bundled resources.

Although the blog post is specifically talking about the new Playgrounds it would appear they have used the same renderer in Xcode to generate quick-doc/quick-help (which is great).

What I've gathered is that the following is supported

  • Code block : Indent some number of spaces. (Behavior seems a little temperamental because sometimes it seems just 1 space will work)
  • Bold Text: **
  • Italic Text: *

The following does not seem to work:

  • Any sort of URL Linking
  • Underline

The Playground markdown document is here: https://developer.apple.com/library/prerelease/ios/documentation/Swift/Reference/Playground_Ref/Chapters/MarkupReference.html however as seen above not everything is applicable to inline documentation of code

Upvotes: 1

Related Questions