Skip to content

Commit a348203

Browse files
authored
Mark "syntax outline" code listings as Swift (#44)
Without any language in the markdown, they don't get syntax highlighting.
2 parents 01bf9fb + 45717bf commit a348203

File tree

15 files changed

+116
-115
lines changed

15 files changed

+116
-115
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
.swiftpm
33
/.build
44
/Package.resolved
5+
.docc-build

Sources/TSPL/TSPL.docc/LanguageGuide/Closures.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ using closure expression syntax.
134134

135135
Closure expression syntax has the following general form:
136136

137-
```
137+
```swift
138138
{ (<#parameters#>) -> <#return type#> in
139139
<#statements#>
140140
}

Sources/TSPL/TSPL.docc/LanguageGuide/CollectionTypes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ which is a shorthand way to write one or more values as an array collection.
192192
An array literal is written as a list of values, separated by commas,
193193
surrounded by a pair of square brackets:
194194

195-
```
195+
```swift
196196
[<#value 1#>, <#value 2#>, <#value 3#>]
197197
```
198198

@@ -1142,7 +1142,7 @@ the key and value in each key-value pair are separated by a colon.
11421142
The key-value pairs are written as a list, separated by commas,
11431143
surrounded by a pair of square brackets:
11441144

1145-
```
1145+
```swift
11461146
[<#key 1#>: <#value 1#>, <#key 2#>: <#value 2#>, <#key 3#>: <#value 3#>]
11471147
```
11481148

Sources/TSPL/TSPL.docc/LanguageGuide/ControlFlow.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ a set of statements is repeated until the condition becomes `false`.
306306

307307
Here's the general form of a `while` loop:
308308

309-
```
309+
```swift
310310
while <#condition#> {
311311
<#statements#>
312312
}
@@ -508,7 +508,7 @@ It then continues to repeat the loop until the condition is `false`.
508508
509509
Here's the general form of a `repeat`-`while` loop:
510510

511-
```
511+
```swift
512512
repeat {
513513
<#statements#>
514514
} while <#condition#>
@@ -794,7 +794,7 @@ for responding to multiple potential states.
794794
In its simplest form, a `switch` statement compares a value against
795795
one or more values of the same type.
796796

797-
```
797+
```swift
798798
switch <#some value to consider#> {
799799
case <#value 1#>:
800800
<#respond to value 1#>
@@ -1602,7 +1602,7 @@ a label on the same line as the statement's introducer keyword, followed by a co
16021602
Here's an example of this syntax for a `while` loop,
16031603
although the principle is the same for all loops and `switch` statements:
16041604

1605-
```
1605+
```swift
16061606
<#label name#>: while <#condition#> {
16071607
<#statements#>
16081608
}
@@ -1922,7 +1922,7 @@ for the full list, see <doc:Attributes#Declaration-Attributes>.
19221922
In addition to specifying major version numbers like iOS 8 or macOS 10.10,
19231923
you can specify minor versions numbers like iOS 11.2.6 and macOS 10.13.3.
19241924

1925-
```
1925+
```swift
19261926
if #available(<#platform name#> <#version#>, <#...#>, *) {
19271927
<#statements to execute if the APIs are available#>
19281928
} else {

Sources/TSPL/TSPL.docc/LanguageGuide/ErrorHandling.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ to determine which one of them can handle the error.
395395

396396
Here is the general form of a `do`-`catch` statement:
397397

398-
```
398+
```swift
399399
do {
400400
try <#expression#>
401401
<#statements#>

Sources/TSPL/TSPL.docc/LanguageGuide/Initialization.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -922,7 +922,7 @@ will save time or make initialization of the class clearer in intent.
922922
Designated initializers for classes are written in the same way as
923923
simple initializers for value types:
924924

925-
```
925+
```swift
926926
init(<#parameters#>) {
927927
<#statements#>
928928
}
@@ -933,7 +933,7 @@ Convenience initializers are written in the same style,
933933
but with the `convenience` modifier placed before the `init` keyword,
934934
separated by a space:
935935

936-
```
936+
```swift
937937
convenience init(<#parameters#>) {
938938
<#statements#>
939939
}

Sources/TSPL/TSPL.docc/LanguageGuide/TheBasics.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1411,7 +1411,7 @@ as part of a single action.
14111411

14121412
Write an optional binding for an `if` statement as follows:
14131413

1414-
```
1414+
```swift
14151415
if let <#constantName#> = <#someOptional#> {
14161416
<#statements#>
14171417
}

Sources/TSPL/TSPL.docc/ReferenceManual/Attributes.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ the compiler shouldn't generate a warning if the return value is unused.
1313
You specify an attribute by writing the `@` symbol followed by the attribute's name
1414
and any arguments that the attribute accepts:
1515

16-
```
16+
```swift
1717
@<#attribute name#>
1818
@<#attribute name#>(<#attribute arguments#>)
1919
```
@@ -77,7 +77,7 @@ including important milestones.
7777
of the specified platform or language in which the declaration was introduced.
7878
It has the following form:
7979

80-
```
80+
```swift
8181
introduced: <#version number#>
8282
```
8383
The *version number* consists of one to three positive integers,
@@ -86,7 +86,7 @@ including important milestones.
8686
of the specified platform or language in which the declaration was deprecated.
8787
It has the following form:
8888

89-
```
89+
```swift
9090
deprecated: <#version number#>
9191
```
9292
The optional *version number* consists of one to three positive integers,
@@ -100,15 +100,15 @@ including important milestones.
100100
it's removed from the specified platform or language and can no longer be used.
101101
It has the following form:
102102

103-
```
103+
```swift
104104
obsoleted: <#version number#>
105105
```
106106
The *version number* consists of one to three positive integers, separated by periods.
107107
- The `message` argument provides a textual message that the compiler displays
108108
when emitting a warning or error about the use of a deprecated or obsoleted declaration.
109109
It has the following form:
110110

111-
```
111+
```swift
112112
message: <#message#>
113113
```
114114
The *message* consists of a string literal.
@@ -118,7 +118,7 @@ including important milestones.
118118
when emitting an error about the use of a renamed declaration.
119119
It has the following form:
120120

121-
```
121+
```swift
122122
renamed: <#new name#>
123123
```
124124
The *new name* consists of a string literal.You can apply the `available` attribute
@@ -198,7 +198,7 @@ If an `available` attribute only specifies an `introduced` argument
198198
in addition to a platform or language name argument,
199199
you can use the following shorthand syntax instead:
200200

201-
```
201+
```swift
202202
@available(<#platform name#> <#version number#>, *)
203203
@available(swift <#version number#>)
204204
```

0 commit comments

Comments
 (0)