Skip to content

Commit bffb3ef

Browse files
authored
Merge branch 'main' into extensions-to-external-types
2 parents 75de218 + d991842 commit bffb3ef

File tree

57 files changed

+2236
-737
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+2236
-737
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ active development and source stability is not guaranteed.
250250
Swift-DocC tracks all bug reports with
251251
[GitHub Issues](https://github.com/apple/swift-docc/issues).
252252
When you submit a bug report we ask that you follow the
253-
[provided template](https://github.com/apple/swift-docc/issues/new?template=BUG_REPORT.md)
253+
[provided template](https://github.com/apple/swift-docc/issues/new?assignees=&labels=bug&template=BUG_REPORT.yml)
254254
and provide as many details as possible.
255255

256256
> **Note:** You can use the [`environment`](bin/environment) script
@@ -268,7 +268,7 @@ that will help us track down the bug faster.
268268
### Submitting a Feature Request
269269

270270
For feature requests, please feel free to file a
271-
[GitHub issue](https://github.com/apple/swift-docc/issues/new?template=FEATURE_REQUEST.md)
271+
[GitHub issue](https://github.com/apple/swift-docc/issues/new?assignees=&labels=enhancement&template=FEATURE_REQUEST.yml)
272272
or start a discussion on the [Swift Forums](https://forums.swift.org/c/development/swift-docc).
273273

274274
Don't hesitate to submit a feature request if you see a way
82.6 KB
Loading
84 KB
Loading

Sources/DocCDocumentation/DocCDocumentation.docc/distributing-documentation-to-other-developers.md

Lines changed: 54 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,65 @@ Distributing your documentation involves the following steps:
2424

2525
### Generate a Publishable Archive of Your Documentation
2626

27-
To create a documentation archive, use the `docc` command-line tool.
27+
To create a documentation archive for a Swift package, use the [SwiftPM DocC
28+
Plugin](https://apple.github.io/swift-docc-plugin/documentation/swiftdoccplugin/)
29+
or use Xcode's _Build Documentation_ command.
2830

29-
To export the documentation archive from the command line, run `docc` in Terminal.
30-
31-
For example, to build a documentation archive, use a command similar to the
32-
following:
31+
Alternatively, use the `docc` command-line tool directly, for example:
3332

3433
```shell
35-
docc convert MyNewPackage.docc --fallback-display-name MyNewPackage --fallback-bundle-identifier com.example.MyNewPackage --fallback-bundle-version 1 --additional-symbol-graph-dir .build --output-dir MyNewPackage.doccarchive
34+
docc convert MyNewPackage.docc \
35+
--fallback-display-name MyNewPackage \
36+
--fallback-bundle-identifier com.example.MyNewPackage \
37+
--fallback-bundle-version 1 \
38+
--additional-symbol-graph-dir .build \
39+
--output-dir MyNewPackage.doccarchive
40+
```
41+
42+
#### Include links to your project's sources
43+
44+
When publishing documentation to an audience that has access to your project's
45+
sources, e.g., for an open-source project hosted on GitHub, consider configuring
46+
DocC to automatically include links to the declarations of your project's symbols.
47+
48+
For example, in the following screenshot, the "ParsableCommand.swift" link
49+
below the declaration navigates to the `ParsableCommand` declaration in the
50+
project's GitHub repository.
51+
52+
![A DocC documentation page showing the title and declaration of a symbol
53+
called ParsableCommand. Under the declaration, there is a link with a Swift
54+
icon and the file name ParsableCommand.swift](link-to-source.png)
55+
56+
To configure DocC to generate links to your project's sources, use the source
57+
service configuration flags like so:
58+
59+
**GitHub**
60+
```bash
61+
docc convert […] \
62+
--source-service github \
63+
--source-service-base-url https://github.com/<org>/<repo>/blob/<branch> \
64+
--checkout-path <path to local checkout>
65+
```
66+
67+
**GitLab**
68+
```bash
69+
docc convert […] \
70+
--source-service gitlab \
71+
--source-service-base-url https://gitlab.com/<org>/<repo>/-/tree/<branch> \
72+
--checkout-path <path to local checkout>
73+
```
74+
75+
**BitBucket**
76+
```bash
77+
docc convert […] \
78+
--source-service bitbucket \
79+
--source-service-base-url https://bitbucket.org/<org>/<repo>/src/<branch> \
80+
--checkout-path <path to local checkout>
3681
```
3782

83+
These arguments can also be provided to `swift package generate-documentation`
84+
if you're using the SwiftPM DocC Plugin or via the `OTHER_DOCC_FLAGS` build
85+
setting when building in Xcode.
3886

3987
### Send a Documentation Archive Directly to Developers
4088

Sources/SwiftDocC/Model/Rendering/RenderContentCompiler.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,16 +211,18 @@ struct RenderContentCompiler: MarkupVisitor {
211211
mutating func visitBlockDirective(_ blockDirective: BlockDirective) -> [RenderContent] {
212212
switch blockDirective.name {
213213
case Snippet.directiveName:
214-
let arguments = blockDirective.arguments()
215-
guard let snippetURL = arguments[Snippet.Semantics.Path.argumentName],
216-
let snippetReference = resolveSymbolReference(destination: snippetURL.value),
214+
guard let snippet = Snippet(from: blockDirective, for: bundle, in: context) else {
215+
return []
216+
}
217+
218+
guard let snippetReference = resolveSymbolReference(destination: snippet.path),
217219
let snippetEntity = try? context.entity(with: snippetReference),
218220
let snippetSymbol = snippetEntity.symbol,
219221
let snippetMixin = snippetSymbol.mixins[SymbolGraph.Symbol.Snippet.mixinKey] as? SymbolGraph.Symbol.Snippet else {
220222
return []
221223
}
222224

223-
if let requestedSlice = arguments[Snippet.Semantics.Slice.argumentName]?.value,
225+
if let requestedSlice = snippet.slice,
224226
let requestedLineRange = snippetMixin.slices[requestedSlice] {
225227
// Render only the slice.
226228
let lineRange = requestedLineRange.lowerBound..<min(requestedLineRange.upperBound, snippetMixin.lines.count)

0 commit comments

Comments
 (0)