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
1212public import Markdown
1313import SymbolKit
1414
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.
1536public final class Snippet : Semantic , AutomaticDirectiveConvertible {
1637 public static let introducedVersion = " 5.7 "
1738 public let originalMarkup : BlockDirective
Original file line number Diff line number Diff line change 52535253 "domain" : " Swift-DocC" ,
52545254 "introduced" : {
52555255 "major" : 5 ,
5256- "minor" : 6 ,
5256+ "minor" : 7 ,
52575257 "patch" : 0
52585258 }
52595259 }
53105310 ],
53115311 "docComment" : {
53125312 "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+ },
53135364 {
53145365 "text" : " - Parameters:"
53155366 },
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments