You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Clarify that links to tutorials don't need a /tutorials/ prefix (#835)
* Clarify that links to tutorials don't need a /tutorials/ prefix
* Explain that articles match first in tutorial file name collisions
rdar://124124417
Copy file name to clipboardExpand all lines: Sources/docc/DocCDocumentation.docc/linking-to-symbols-and-other-content.md
+13-7Lines changed: 13 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -166,10 +166,10 @@ path in either source language.
166
166
### Navigate to an Article
167
167
168
168
To add a link to an article, use the less-than symbol (`<`), the `doc` keyword,
169
-
a colon (`:`), the name of the article, and a greater-than symbol
170
-
(`>`). Don't include the article's file extension in the name.
169
+
a colon (`:`), the article's file name without file extension, and a greater-than symbol
170
+
(`>`).
171
171
172
-
```
172
+
```markdown
173
173
<doc:GettingStarted>
174
174
```
175
175
@@ -181,11 +181,17 @@ For example, the link to an article with a file name "Getting Started.md" is
181
181
```
182
182
183
183
When DocC resolves the link, it uses the article's page title as the link's
184
-
text, and the article's filename as the link's URL. Links to tutorials follow
185
-
the same format, except you must add the `/tutorials/` prefix to the path:
184
+
text. Links to tutorials follow the same format.
186
185
186
+
```markdown
187
+
<doc:SlothCreator>
187
188
```
188
-
<doc:/tutorials/SlothCreator>
189
+
190
+
If you have an article file and a tutorial file with the same base name, DocC will resolve the `<doc:BaseName>` link to the article. To refer to the tutorial instead you can add a leading `tutorials` component to the path, with or without a leading slash:
191
+
192
+
```markdown
193
+
<doc:tutorials/BaseName>
194
+
<doc:/tutorials/BaseName>
189
195
```
190
196
191
197
> Tip: You can also link to symbols using the `<doc:>` syntax. Just insert the
@@ -238,4 +244,4 @@ add the link's URL within the parentheses.
238
244
[Apple](https://www.apple.com)
239
245
```
240
246
241
-
<!-- Copyright (c) 2023 Apple Inc and the Swift Project authors. All Rights Reserved. -->
247
+
<!-- Copyright (c) 2023-2024 Apple Inc and the Swift Project authors. All Rights Reserved. -->
0 commit comments