Skip to content

Commit e8cd2ae

Browse files
committed
simplify package layout, and add Further Reading links, and an example of URL-safe character encoding
1 parent d50e3fc commit e8cd2ae

14 files changed

+22
-8
lines changed

Package.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ let package:Package = .init(
1212
],
1313
dependencies: [],
1414
targets: [
15-
.target(name: "grammar", path: "Sources/Grammar"),
16-
.target(name: "help", path: "Sources/Help"),
17-
.target(name: "proposals", path: "Sources/Proposals"),
15+
.target(name: "grammar"),
16+
.target(name: "help"),
17+
.target(name: "proposals"),
1818
])
1919

2020
for target:PackageDescription.Target in package.targets

Snippets/Codelinks.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
../Sources/Help/Codelinks.swift
1+
../Sources/help/Codelinks.swift
File renamed without changes.
File renamed without changes.
File renamed without changes.

Sources/Grammar/Grammar.md renamed to Sources/grammar/docs.docc/Grammar.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ A full disambiguator consists of an optional type signature pattern, and an opti
44

55
```ebnf
66
Disambiguator ::= \s + SignaturePattern Clauses ? | Clauses ;
7-
DisambiguationSuffix ::= SignatureSuffix Clauses ? | Clauses
7+
DisambiguationSuffix ::= SignatureSuffix Clauses ? | Clauses ;
88
```
99

1010

File renamed without changes.

Sources/Help/Codelinks.md renamed to Sources/help/docs.docc/Codelinks.md

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

3-
**Codelinks**, also known as **symbol links**, are a markdown shorthand for referencing Swift declarations in documentation.
3+
**Codelinks**, also known as **symbol links**, are a Markdown shorthand for referencing Swift declarations in documentation. Documentation engines will automatically resolve and expand these references into hyperlinks to the corresponding symbols.
44

55
You write codelinks using double backticks. Here are some examples:
66

@@ -16,7 +16,7 @@ A Swift documentation engine, such as [Unidoc](https://github.com/tayloraswift/s
1616
``String``
1717
``String.Index``
1818

19-
But in a regular markdown viewer, they will just look like this:
19+
But in a regular Markdown viewer, they will just look like this:
2020

2121
`Int`
2222
`String`
@@ -32,7 +32,7 @@ Use the slash character (`/`) in place of the period (`.`) separator to mark whe
3232
| ` ``String.Index`` ` | ``String.Index`` |
3333
| ` ``String/Index`` ` | ``String/Index`` |
3434

35-
Readers using a regular markdown viewer will see the entire path, but documentation engines will only display the specified path suffix.
35+
Readers using a regular Markdown viewer will see the entire path, but documentation engines will only display the specified path suffix.
3636

3737

3838
## Linking to functions and subscripts
@@ -136,6 +136,13 @@ You can filter a codelink by phylum to disambiguate it. For example, if you have
136136
| ` ``Example.property [var]`` ` | ``Example.property [var]`` |
137137
| ` ``Example.property [static var]`` ` | ``Example.property [static var]`` |
138138

139+
Alternatively, you can replace the spaces with hyphens (`-`) to encode the codelink with URL-friendly characters. This is useful when you want to display custom link text.
140+
141+
| Syntax | Renders as |
142+
| ------ | ---------- |
143+
| ` [custom text](Example.property-[var]) ` | [custom text](Example.property-[var]) |
144+
| ` [custom text](Example.property-[static-var]) ` | [custom text](Example.property-[static-var]) |
145+
139146
Below is an exhaustive list of all supported phylum filters.
140147

141148
| Disambiguator | Notes |
@@ -419,3 +426,10 @@ If you need to use filters alongside signature patterns, put the filters in brac
419426
| ` ``ExampleProtocol/g(_:) (Int32) [requirement: false]`` ` | ``ExampleProtocol/g(_:) (Int32) [requirement: false]`` |
420427
| ` ``ExampleProtocol/g(_:) (Int64) -> () [requirement: false]`` ` | ``ExampleProtocol/g(_:) (Int64) -> () [requirement: false]`` |
421428
| ` ``ExampleProtocol/g(_:) (Int64) -> Int64 [requirement: false]`` ` | ``ExampleProtocol/g(_:) (Int64) -> Int64 [requirement: false]`` |
429+
430+
431+
## Further reading
432+
433+
- <doc://grammar/documentation/grammar/Grammar>
434+
- <doc://proposals/documentation/proposals/SDWG-0000-Codelink-paths>
435+
- <doc://proposals/documentation/proposals/SDWG-0001-Phylum-based-disambiguators>
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)