Skip to content

Instantly share code, notes, and snippets.

@imjhk03
Created January 8, 2023 07:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save imjhk03/b2b039000b9afebc1ba7c13b251fccab to your computer and use it in GitHub Desktop.
Save imjhk03/b2b039000b9afebc1ba7c13b251fccab to your computer and use it in GitHub Desktop.
Swift Playground Markup Formatting Reference
1. Using Markup
Single Line comment
//: line of markup content
Multi Line Comment
/*:
...
*/
2. Headings
# Heading 1 String
## Heading 2 String
### Heading 3 String
3. Horizontal Rules
--- | *** | ___
```
// Example
/*:
This text is above the horizontal rule.
- - -
And this is below.
*/
```
4. Lists
Bulleted Lists
* | + | - string
```
// Example
/*:
- Item 1, List A
- Item 2, List A
* Item 1, List B
+ Item 1, List C
*/
```
Numbered Lists
```integer. string```
```
// Example
/*:
1. Cat
2. Dog
1. Golden Retriever
3. Llama
*/
```
5. Code Block
One tab inside Multi comment or use four backquotes (`)
```
// Example
/*:
A loop to print each character on a seperate line
for character in "Cat" {
println(character)
}
*/
// or
/**
An example of using a *code block*
A loop to print each character on a seperate line
````
for character in "Cat" {
print(character)}
}
````
*/
```
6. Code Voice, Italics, Strong
Code Voice: `code`
Italics: `italic`, _italic_
Strong: **strong**, __strong__
7. Links
[text to display](URL)
//: Find more information for [Swift](http://swift.org)
8. Next Page, Previous Page, Named Page
Next Page: [link name](@next)
Previous Page: [line name](@previous)
Named Page: [link name](name of the playground document to open)
Replace spaces in the name of the playground page with the ASCII character code for space (%20)
9. Images
![alternate text](URL "hover title")
//: ![The real head of the household?](cat.png)
10. Videos
![alternate text](video name poster="image file name" width="integer width" height="integer height")
//: Watch the WWDC session introducing the San Francisco Font
//: ![San Francisco font introduction](new-fonts.mp4)
Example: Poster Frame and Custom Size
//: Watch the WWDC session introducing the San Francisco Font
//:
//: *The player is a custom size and has a poster image*
//: ![](new-fonts.mp4 poster="font-poster.png" width="960" height="570")
11. Callouts
You can use Note, Example, Important terms or use Custom Callout to change name. It has different colors, but you can't change the color.
/*:
* Callout(Code Tips):
Some code
- Example:
example
* Experiment:
experiment
- Important:
important
* Note:
notes
*/
12. Escapes
\special character
/*
Reference
[Markup Formatting Reference](https://developer.apple.com/library/archive/documentation/Xcode/Reference/xcode_markup_formatting_ref/index.html#//apple_ref/doc/uid/TP40016497-CH2-SW1)
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment