Skip to content

Commit 2084946

Browse files
Structural changes to the DocCDocumentation Catalog (#742)
Made content changes to the DocCDocumentation Catalog. - Added a new section `Documentation Content`. - Arranged content from `Formatting Your Documentation Content`into `Formatting Your Documentation Content``Other Formatting Options` `Adding Images to Your Content` and `Link to Symbols and Other Content`. - Added minor comments about conceptual documentation. - Capitalized third-level titles. - Minor changes to titles and summaries around the catalog content. - Updated the year in the files footers. - Changed 'Link' to 'Linking' to use preferred gerund form - Supported image extensions added. - Added documentation about support of hex and html codes. --------- Co-authored-by: Chuck Toporek <[email protected]>
1 parent 38c9b8a commit 2084946

8 files changed

+374
-353
lines changed

Sources/docc/DocCDocumentation.docc/DocC Documentation.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Produce rich API reference documentation and interactive tutorials for your Swif
1010

1111
The DocC documentation compiler converts Markdown-based text into rich documentation for Swift frameworks and packages. You can preview the documentation in its published form as you work on it, and also host it on a website when it's complete.
1212

13-
DocC syntax — called _documentation markup_ — is a custom variant of Markdown that adds functionality for developer-specific documentation features, like cross-symbol linking, term-definition lists, code listings, and asides. You add documentation markup to your source code, compile it with DocC, and produce reference documentation for your APIs. You can also use documentation markup, along with a set of directives that instruct how DocC generates your content, to offer step-by-step tutorials that teach developers to use your APIs through interactive coding exercises.
13+
DocC syntax — called _documentation markup_ — is a custom variant of Markdown that adds functionality for developer-specific documentation features, like cross-symbol linking, term-definition lists, code listings, and asides. You add documentation markup to your source code, compile it with DocC, and produce reference documentation for your APIs. You can also use documentation markup, along with a set of directives that instruct how DocC generates your content, to offer step-by-step tutorials that teach developers to use your APIs through interactive coding exercises or to craft comprehensive articles that explain specific technologies or topics.
1414

1515
![On the left, a diagram shows a blocked-out example of a compiled tutorial and Markdown. In the middle, a diagram shows a blocked-out example of Markdown. On the right, a diagram shows a blocked-out example of compiled developer documentation.](docc-hero)
1616

@@ -20,20 +20,29 @@ DocC syntax — called _documentation markup_ — is a custom variant of Markdow
2020

2121
- <doc:documenting-a-swift-framework-or-package>
2222

23+
### Documentation Content
24+
2325
- <doc:writing-symbol-documentation-in-your-source-files>
2426

27+
- <doc:adding-supplemental-content-to-a-documentation-catalog>
28+
29+
- <doc:linking-to-symbols-and-other-content>
30+
2531
### Structure and Formatting
2632

2733
- <doc:formatting-your-documentation-content>
2834

35+
- <doc:other-formatting-options>
36+
37+
- <doc:adding-images>
38+
2939
- <doc:adding-structure-to-your-documentation-pages>
3040

31-
- <doc:adding-supplemental-content-to-a-documentation-catalog>
41+
- <doc:customizing-the-appearance-of-your-documentation-pages>
3242

3343
### Distribution
3444

3545
- <doc:distributing-documentation-to-other-developers>
36-
- <doc:customizing-the-appearance-of-your-documentation-pages>
3746

3847
### Documentation Types
3948

@@ -45,4 +54,4 @@ DocC syntax — called _documentation markup_ — is a custom variant of Markdow
4554

4655
- ``Comment``
4756

48-
<!-- Copyright (c) 2021 Apple Inc and the Swift Project authors. All Rights Reserved. -->
57+
<!-- Copyright (c) 2021-2023 Apple Inc and the Swift Project authors. All Rights Reserved. -->

Sources/docc/DocCDocumentation.docc/Reference Syntax/API Reference Syntax/api-reference-syntax.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# API Documentation
22

3-
Teach developers your Swift APIs through reference documentation you create from comments in source code and documentation extension files.
3+
Teach your APIs through reference documentation you create from code comments and extension files, or create detailed articles and conceptual guides.
44

55
## Overview
66

@@ -14,6 +14,7 @@ Use documentation markup, a custom variant of Markdown, to add in-source documen
1414

1515
- ``Options``
1616
- ``Metadata``
17+
- ``TechnologyRoot``
1718

1819
### Creating Custom Page Layouts
1920

@@ -22,4 +23,4 @@ Use documentation markup, a custom variant of Markdown, to add in-source documen
2223
- ``Links``
2324
- ``Small``
2425

25-
<!-- Copyright (c) 2021 Apple Inc and the Swift Project authors. All Rights Reserved. -->
26+
<!-- Copyright (c) 2021-2023 Apple Inc and the Swift Project authors. All Rights Reserved. -->
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Adding Images to Your Content
2+
3+
Elevate your content's visual appeal by adding images.
4+
5+
## Overview
6+
7+
DocC extends Markdown's image support so you can provide appearance and
8+
display scale-aware versions of an image. You use specific components to create image filenames, and DocC uses the most appropriate version of the image when displaying your documentation.
9+
10+
![An image of a filename that's split into four labeled sections to highlight the individual components. From left to right, the components are the image name, the appearance mode, the display scale, and the file extension.](docc-image-filename)
11+
12+
| Component | Description |
13+
| --- | --- |
14+
| Image name | **Required**. Identifies the image within the documentation catalog. The name must be unique across all images in the catalog, even if you store them in separate folders. |
15+
| Appearance | **Optional**. Identifies the appearance mode in which DocC uses the image. Add `~dark` directly after the image name to identify the image as a dark mode variant. |
16+
| Display scale | **Optional**. Identifies the display scale at which DocC uses the image. Possible values are `@1x`, `@2x`, and `@3x`. When specifying a display scale, add it directly before the file extension. |
17+
| File extension | **Required**. Identifies the type of image. The supported file extensions are `png`, `jpg`, `jpeg`, `svg` and `gif`. |
18+
19+
> Tip: To best support your readers, provide images in standard resolution and `@2x` scale.
20+
21+
For example, the following are all valid DocC image filenames:
22+
23+
- term `sloth.png`: An image that's independent of all appearance modes and display scales.
24+
- term `sloth~dark.png`: An image that's specific to dark mode, but is display-scale independent.
25+
- term `[email protected]`: An image that's specific to dark mode and the 2x display scale.
26+
27+
> Important: Include the image files in your documentation catalog. For more information, see <doc:documenting-a-swift-framework-or-package>.
28+
29+
To add an image, use an exclamation mark (`!`), a set of brackets
30+
(`[]`), and a set of parentheses (`()`).
31+
32+
Within the brackets, add a description of the image. This text, otherwise known as _alternative text_, is used by screen readers for people who have vision difficulties. Provide enough detail to describe the image so that people can understand what the image shows.
33+
34+
Within the parentheses, include only the image name. Omit the appearance,
35+
display scale, and file extension components. Don't include the path to the
36+
image.
37+
38+
```markdown
39+
![A sloth hanging off a tree.](sloth)
40+
```
41+
42+
<!-- Copyright (c) 2023 Apple Inc and the Swift Project authors. All Rights Reserved. -->

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ docc convert MyNewPackage.docc \
3939
--output-dir MyNewPackage.doccarchive
4040
```
4141

42-
#### Include links to your project's sources
42+
#### Include Links to your Project's Sources
4343

4444
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
45+
sources; for example, with an open source project hosted on GitHub, consider configuring
4646
DocC to automatically include links to the declarations of your project's symbols.
4747

4848
For example, in the following screenshot, the "ParsableCommand.swift" link
@@ -113,7 +113,7 @@ documentation might resemble the following:
113113
https://www.example.com/documentation/MyNewPackage/MyNewProtocol
114114
```
115115

116-
#### Host a documentation archive with a file server
116+
#### Host a Documentation Archive with a File Server
117117

118118
You can host documentation archives you create with DocC from the Swift 5.7
119119
toolchain and later using a regular file server. By default, the server hosts
@@ -145,7 +145,7 @@ the `DOCC_HOSTING_BASE_PATH` build setting when building documentation in Xcode.
145145

146146
[plugin-docs]: https://apple.github.io/swift-docc-plugin/documentation/swiftdoccplugin/generating-documentation-for-hosting-online/
147147

148-
#### Host a documentation archive using custom routing
148+
#### Host a Documentation Archive Using Custom Routing
149149

150150
A file server is the recommended solution to host your documentation. But, if
151151
you need more control over how the server hosts your content, you can configure

Sources/docc/DocCDocumentation.docc/documenting-a-swift-framework-or-package.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,16 @@ step-by-step, interactive content. For more information, see
7171
> Important: To use a documentation catalog in a Swift package, make sure the
7272
manifest's Swift tools version is set to `5.5` or later.
7373

74-
## Building, publishing, and previewing documentation
74+
## Building, Publishing, and Previewing Documentation with the DocC Plug-in
7575

7676
The preferred way of building documentation for your Swift package is by using
7777
the Swift-DocC Plugin. Refer to instructions in the plugin's
7878
[documentation](https://apple.github.io/swift-docc-plugin/documentation/swiftdoccplugin/)
7979
to get started with [building](https://apple.github.io/swift-docc-plugin/documentation/swiftdoccplugin/generating-documentation-for-a-specific-target), [previewing](https://apple.github.io/swift-docc-plugin/documentation/swiftdoccplugin/previewing-documentation),
8080
and publishing your documentation to your [website](https://apple.github.io/swift-docc-plugin/documentation/swiftdoccplugin/generating-documentation-for-hosting-online) or [GitHub Pages](https://apple.github.io/swift-docc-plugin/documentation/swiftdoccplugin/publishing-to-github-pages).
8181

82+
You can also use the DocC command-line interface, as described in <doc:distributing-documentation-to-other-developers>.
83+
8284
## See Also
8385

8486
- <doc:writing-symbol-documentation-in-your-source-files>

0 commit comments

Comments
 (0)