File tree Expand file tree Collapse file tree 3 files changed +73
-20
lines changed
SwiftDocC/Semantics/Snippets
docc/DocCDocumentation.docc
Reference Syntax/API Reference Syntax Expand file tree Collapse file tree 3 files changed +73
-20
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,27 @@ import Foundation
12
12
public import Markdown
13
13
import SymbolKit
14
14
15
+ // NOTE: If you update the DocC content, remember to run
16
+ // `swift run generate-symbol-graph` to regenerate the DocC
17
+ // symbol content for the DocC Documentation.
18
+
19
+ /// Embeds a code example from the project's code snippets.
20
+ ///
21
+ /// ```markdown
22
+ /// @Snippet(path: "my-package/Snippets/example-snippet", slice: "setup")
23
+ /// ```
24
+ ///
25
+ /// Place the `Snippet` directive to embed a code example from the project's snippet directory.
26
+ /// The path that references the snippet is identified with three parts:
27
+ ///
28
+ /// 1. The package name as defined in `Package.swift`
29
+ ///
30
+ /// 2. The directory path to the snippet file, starting with "Snippets".
31
+ ///
32
+ /// 3. The name of your snippet file without the `.swift` extension
33
+ ///
34
+ /// If the snippet had slices annotated within it, an individual slice of the snippet can be referenced with the `slice` option.
35
+ /// Without the option defined, the directive embeds the entire snippet.
15
36
public final class Snippet : Semantic , AutomaticDirectiveConvertible {
16
37
public static let introducedVersion = " 5.7 "
17
38
public let originalMarkup : BlockDirective
Original file line number Diff line number Diff line change 5253
5253
"domain" : " Swift-DocC" ,
5254
5254
"introduced" : {
5255
5255
"major" : 5 ,
5256
- "minor" : 6 ,
5256
+ "minor" : 7 ,
5257
5257
"patch" : 0
5258
5258
}
5259
5259
}
5310
5310
],
5311
5311
"docComment" : {
5312
5312
"lines" : [
5313
+ {
5314
+ "text" : " Embeds a code example from the project's code snippets."
5315
+ },
5316
+ {
5317
+ "text" : " "
5318
+ },
5319
+ {
5320
+ "text" : " ```markdown"
5321
+ },
5322
+ {
5323
+ "text" : " @Snippet(path: \" my-package\/ Snippets\/ example-snippet\" , slice: \" setup\" )"
5324
+ },
5325
+ {
5326
+ "text" : " ```"
5327
+ },
5328
+ {
5329
+ "text" : " "
5330
+ },
5331
+ {
5332
+ "text" : " Place the `Snippet` directive to embed a code example from the project's snippet directory."
5333
+ },
5334
+ {
5335
+ "text" : " The path that references the snippet is identified with three parts:"
5336
+ },
5337
+ {
5338
+ "text" : " "
5339
+ },
5340
+ {
5341
+ "text" : " 1. The package name as defined in `Package.swift`"
5342
+ },
5343
+ {
5344
+ "text" : " "
5345
+ },
5346
+ {
5347
+ "text" : " 2. The directory path to the snippet file, starting with \" Snippets\" ."
5348
+ },
5349
+ {
5350
+ "text" : " "
5351
+ },
5352
+ {
5353
+ "text" : " 3. The name of your snippet file without the `.swift` extension"
5354
+ },
5355
+ {
5356
+ "text" : " "
5357
+ },
5358
+ {
5359
+ "text" : " If the snippet had slices annotated within it, an individual slice of the snippet can be referenced with the `slice` option."
5360
+ },
5361
+ {
5362
+ "text" : " Without the option defined, the directive embeds the entire snippet."
5363
+ },
5313
5364
{
5314
5365
"text" : " - Parameters:"
5315
5366
},
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments