Skip to content

Commit c44f024

Browse files
Clarify documentation related to article file names, and documentation extension file names. (#874)
* Clarify documentation related to article file names, and documentation extension file names. * PR feedback: Rephrase and supplement documentation related to article file names, and documentation extension file names.
1 parent a1335c3 commit c44f024

File tree

2 files changed

+57
-10
lines changed

2 files changed

+57
-10
lines changed

Sources/docc/DocCDocumentation.docc/adding-structure-to-your-documentation-pages.md

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,17 +141,36 @@ default organization and provide a more appropriate structure for your symbols.
141141

142142
![A screenshot showing the rendered documentation containing three topic groups: Creating a Sloth, Activities, and Schedule.](4_topics_2)
143143

144-
To add an extension file to your documentation catalog for a specific symbol, use a text editor to create a new file named `Extension.md`.
144+
To add an extension file for a specific symbol, use a text editor to create an
145+
`.md` file within the documentation catalog. DocC ignores file names of
146+
documentation extensions; you can choose any file name you would like as long
147+
as it uses an `.md` extension. (DocC determines the URL path of source
148+
documentation from the symbol's name, type and parent type among other things.)
149+
Then open the file and add a level 1 header on the first line. Finally, set the
150+
level 1 header's title to be a link to the corresponding symbol.
145151

146-
In the `Extension.md` file, replace the `Symbol` placeholder
147-
with the symbol path of the symbol you're organizing and rename the file accordingly.
152+
Here's an example of a level 1 header set to be a symbol link:
148153

149154
```markdown
150155
# ``SlothCreator/Sloth``
151156
```
152157

153-
> Important: The symbol path for the page title of an extension file needs to start
154-
with the name of a top-level symbol or the name of the framework.
158+
> Note: If you're working in Xcode, you can select the documentation catalog in
159+
> the project navigator and run the "File -> New -> File From Template..." menu
160+
> command. Then click "Extension File" under the Documentation section. In the
161+
> new markdown file, replace the "Symbol" placeholder with a link to the
162+
> corresponding symbol, and rename the file accordingly.
163+
164+
> Important:
165+
> If DocC can't resolve the symbol link in the level 1 header of the extension
166+
> file, it will raise a warning about the link and skip the rest of the content
167+
> of that extension file.
168+
>
169+
> DocC resolves symbol links in extension file headers relative to the module.
170+
> To create an extension file for a nested type or member symbol, start the
171+
> symbol link with the name of the top-level symbol that contains the nested
172+
> type or member symbol. You can optionally prefix the symbol link with the
173+
> name of the module, but DocC does not require this prefix.
155174
156175
The Extension File template includes a `Topics` section with a single named
157176
group, ready for you to fill out. Alternatively, if your documentation catalog

Sources/docc/DocCDocumentation.docc/adding-supplemental-content-to-a-documentation-catalog.md

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,19 @@ habitat.
6262
...
6363
```
6464

65-
To add an article to your documentation catalog, use a text editor and create a file with an appropriate title and add a `.md` extension.
65+
To add an article to your documentation catalog, use a text editor and create a
66+
file with an appropriate title and add an `.md` extension.
67+
68+
> Important:
69+
> DocC uses the article's lowercased file name, with consecutive
70+
> sequences of whitespace and punctuation replaced with a hyphen (`-`), as a
71+
> path component in the URL for that page.
72+
>
73+
> If two or more articles have the same file name, DocC will raise a warning
74+
> and skip building documentation for all but one of those articles.
75+
>
76+
> DocC doesn't display the article file name in content. Instead, it uses the
77+
> title from the level 1 header in places where the article is referenced.
6678
6779
After the Overview section, additional sections and subsections use a double
6880
hash (##) for a level 2 header, and a triple hash (###) for a level 3 header.
@@ -89,10 +101,26 @@ Although writing documentation comments in source files has many benefits, in so
89101
* When your source documentation comments focus on the implementation of your
90102
code, and aren't appropriate for external documentation
91103

92-
To add an extension file to your documentation catalog, create a file within the documentation catalog, then modify the first line of the file to identify the symbol that the file relates to using a symbol link in a level 1 header.
93-
For more information on linking to symbols, see <doc:linking-to-symbols-and-other-content>.
94-
95-
> Important: The symbol path for the page title of an extension file need to start with the name of a top-level symbol or the name of the framework.
104+
To add an extension file to your documentation catalog, create a file within the
105+
documentation catalog, then modify the first line of the file to identify the
106+
symbol that the file relates to using a symbol link in a level 1 header. For
107+
more information on linking to symbols, see
108+
<doc:linking-to-symbols-and-other-content>.
109+
110+
DocC ignores file names of documentation extensions; you can choose any file
111+
name you would like as long as it uses an `.md` extension. DocC determines the
112+
URL path of source documentation from the symbol's name, type and parent type
113+
among other things.
114+
115+
> Important: If DocC can't resolve the symbol link in the level 1 header of the
116+
> extension file, it will raise a warning about the link and skip the rest of
117+
> the content of that extension file.
118+
>
119+
> DocC resolves symbol links in extension file headers relative to the module.
120+
> To create an extension file for a nested type or member symbol, start the
121+
> symbol link with the name of the top-level symbol that contains the nested
122+
> type or member symbol. You can optionally prefix the symbol link with the
123+
> name of the module, but DocC does not require this prefix.
96124
97125
By default, the extension file's content adds to the symbol's existing source documentation comment.
98126
You can leave key information in the documentation comment---where it's available to people reading the source code---and use the extension file for longer documentation, code examples, images, and for organizing you documentation hierarchy.

0 commit comments

Comments
 (0)