Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Commit 0afc062

Browse files
authored
Merge branch 'master' into small-copy-edits-readme
2 parents 9fa0ddd + 859d9b9 commit 0afc062

File tree

1 file changed

+61
-43
lines changed

1 file changed

+61
-43
lines changed

README.md

Lines changed: 61 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,44 @@ for each class, structure, enumeration, and protocol
1111
as well as top-level type aliases, functions, and variables.
1212

1313
For an example of generated documentation,
14-
[check out the Uncyclo for our fork of Alamofire][alamofire wiki].
14+
[check out the Uncyclo for our fork of Alamofire][alamofire wiki].
1515

1616
> **Note**:
1717
> Output is currently limited to CommonMark,
1818
> but the plan is to support HTML and other formats as well.
1919
20-
## Usage
20+
## Command-Line Utility
2121

22-
`swift-doc` can be used from the command-line
23-
or in a [GitHub Actions][github actions] workflow.
22+
`swift-doc` can be used from the command-line on macOS and Linux.
2423

25-
### Command-Line Utility
24+
### Installation
2625

27-
To run `swift-doc` from the command-line,
28-
clone the repository
29-
and do `swift run swift-doc` from within the project directory.
26+
#### Homebrew
27+
28+
Run the following command to install using [Homebrew](https://brew.sh/):
29+
30+
```terminal
31+
$ brew install swiftdocorg/formulae/swift-doc
32+
```
33+
34+
#### Manually
35+
36+
Run the following commands to build and install manually:
3037

3138
```terminal
32-
$ git clone https://github.com/SwiftDocOrg/swift-doc.git
39+
$ git clone https://github.com/SwiftDocOrg/swift-doc
3340
$ cd swift-doc
34-
$ swift run swift-doc path/to/SwiftProject/Sources --output Documentation
41+
$ make install
42+
```
43+
44+
### Usage
45+
46+
`swift-doc` takes one or more paths and enumerates them recursively,
47+
collecting all Swift files into a single "module"
48+
and generating documentation accordingly.
49+
50+
```terminal
51+
$ swift doc path/to/SwiftProject/Sources --output Documentation
3552
$ tree Documentation
3653
$ Documentation/
3754
├── Home
@@ -40,36 +57,33 @@ $ Documentation/
4057
└── _Sidebar.md
4158
```
4259

43-
`swift-doc` takes one or more paths and enumerates them recursively,
44-
collecting all Swift files into a single "module"
45-
and generating documentation accordingly.
4660
By default,
4761
output files are written to `.build/documentation`,
4862
but you can change that with the `--output` option flag.
4963

50-
### GitHub Action
64+
## GitHub Action
5165

5266
This repository also hosts a [GitHub Action][github actions]
5367
that you can incorporate into your project's workflow.
5468

55-
The CommonMark files generated by `swift-doc`
69+
The CommonMark files generated by `swift-doc`
5670
are formatted for publication to your project's [GitHub Uncyclo][github wiki],
57-
which you can do with
71+
which you can do with
5872
[github-wiki-publish-action][github-wiki-publish-action].
5973
Alternatively,
6074
you could publish `swift-doc`-generated documentation to GitHub Pages,
6175
or bundle them into a release artifact.
6276

63-
#### Inputs
77+
### Inputs
6478

65-
- `inputs`:
66-
One or more paths to Swift files in your workspace.
79+
- `inputs`:
80+
One or more paths to Swift files in your workspace.
6781
(Default: `"./Sources"`)
6882
- `output`:
69-
The path for generated output.
83+
The path for generated output.
7084
(Default: `"./.build/documentation"`)
7185

72-
#### Example Workflow
86+
### Example Workflow
7387

7488
```yml
7589
name: Documentation
@@ -95,15 +109,15 @@ jobs:
95109
GITHUB_PERSONAL_ACCESS_TOKEN: ${{ secrets.GITHUB_PERSONAL_ACCESS_TOKEN }}
96110
```
97111
98-
* * *
112+
## Experimental Command-Line Tools
99113
100114
In addition to `swift-doc`,
101-
this project currently ships with several, experimental executables
115+
this project currently ships with several, experimental tools
102116
that offer complementary functionality.
103117
It's unclear how everything will ultimately fit together,
104-
but for now,
118+
but for now,
105119
they're incubating in a shared monorepo
106-
(the intent is for each of them to eventually become
120+
(the intent is for each of them to eventually become
107121
an option, subcommand, or plugin of `swift-doc`).
108122

109123
* * *
@@ -137,10 +151,10 @@ $ swift run swift-dcov SwiftSemantics/Sources/ | jq ".data.symbols[] | select(.d
137151
While there are plenty of tools for assessing test coverage for code,
138152
we weren't able to find anything analogous for documentation coverage.
139153
To this end,
140-
we've contrived a simple JSON format
154+
we've contrived a simple JSON format
141155
[inspired by llvm-cov](https://reviews.llvm.org/D22651#change-xdePaVfBugps).
142156

143-
If you know of an existing standard
157+
If you know of an existing standard
144158
that you think might be better suited for this purpose,
145159
please reach out by [opening an Issue][open an issue]!
146160

@@ -169,7 +183,7 @@ you can feed the output of `swift-api-inventory` to conventional diffing tools
169183
to determine API changes between different releases of a project.
170184

171185
For example,
172-
here's an API diff between the first beta and latest release candidate of
186+
here's an API diff between the first beta and latest release candidate of
173187
[Alamofire 5](https://forums.swift.org/t/alamofire-5-one-year-in-the-making-now-in-beta/18865):
174188

175189
```terminal
@@ -231,7 +245,7 @@ digraph Anonymous {
231245
"URLEncodedFormEncoder" [shape=box,peripheries=2];
232246
"ServerTrustManager" [shape=box];
233247
"MultipartFormData" [shape=box];
234-
248+
235249
subgraph cluster_Request {
236250
"DataRequest" [shape=box];
237251
"Request" [shape=box];
@@ -253,13 +267,13 @@ for both Swift and Objective-C projects.
253267
Over time, however,
254268
the way we write Swift code —
255269
and indeed the language itself —
256-
has evolved to incorporate patterns and features
257-
that are difficult to understand using
270+
has evolved to incorporate patterns and features
271+
that are difficult to understand using
258272
the same documentation standards that served us well for Objective-C.
259273

260274
Whereas in Objective-C,
261275
you could get a complete view of a type's functionality from its class hierarchy,
262-
Swift code today tends to layer and distribute functionality across
276+
Swift code today tends to layer and distribute functionality across
263277
[a network of types][swift number protocols diagram].
264278
While adopting a
265279
[protocol-oriented paradigm][protocol-oriented programming]
@@ -271,7 +285,7 @@ is to make Swift documentation more useful
271285
by surfacing the information you need to understand how an API works
272286
and presenting it in a way that can be easily searched and accessed.
273287
We want developers to be empowered to use Swift packages to their full extent,
274-
without being reliant on (often outdated) blog posts or Stack Overflow threads.
288+
without being reliant on (often outdated) blog posts or Stack Overflow threads.
275289
We want documentation coverage to become as important as test coverage:
276290
a valuable metric for code quality,
277291
and an expected part of first-rate open source projects.
@@ -294,8 +308,10 @@ having instead focused on perceived cosmetic issues.)
294308
Without much in the way of strong design guidance,
295309
we're not entirely sure what Swift documentation _should_ look like.
296310
But we do think plain text is a good place to start.
297-
We look forward to soliciting feedback and ideas from everyone
298-
to identify what those needs are and coming up with the best ways to meet them.
311+
We look forward to
312+
soliciting feedback and ideas from everyone
313+
so that we can identify those needs
314+
and figure out the best ways to meet them.
299315

300316
In the meantime,
301317
we've set ourselves up for success
@@ -320,7 +336,7 @@ Because it relies only on a syntactic reading of Swift source code,
320336
without needing code first to be compiled,
321337
`swift-doc` is quite fast.
322338
As a baseline,
323-
compare its performance to Jazzy
339+
compare its performance to Jazzy
324340
when generating documentation for [SwiftSemantics][swiftsemantics]:
325341

326342
```terminal
@@ -347,17 +363,19 @@ to [a GitHub wiki generated with `swift-doc`][swift-doc swiftsemantics].
347363

348364
## What About [SwiftDoc.org][swiftdoc.org]?
349365

350-
**tl;dr:**
351-
We're currently working on updating SwiftDoc.org for Swift 5,
352-
and hope to have it released later this week.
366+
**tl;dr:**
367+
SwiftDoc.org is now updated for Swift 5.1,
368+
but we're still working to migrate over a few missing parts
369+
(notably, the beloved
370+
[type inheritance graphs](https://swiftdoc.org/v4.2/protocol/expressiblebyfloatliteral/hierarchy/)).
353371

354372
SwiftDoc.org,
355373
[originally "Swifter"](http://natecook.com/blog/2014/09/introducing-swifter/),
356-
was created by Nate Cook ([@natecook1000][@natecook1000])
374+
was created by Nate Cook ([@natecook1000][@natecook1000])
357375
in September 2014.
358376
At the time,
359377
Swift tooling was still in its infancy,
360-
so Nate actually
378+
so Nate actually
361379
[wrote a parser (from scratch!)](https://github.com/SwiftDocOrg/swiftdoc-parser)
362380
to pull symbols and documentation from the Swift standard library.
363381
Nate became managing editor of [NSHipster][nshipster] in 2015,
@@ -369,9 +387,9 @@ After the hand-off,
369387
we were able to get the site updated for Swift 4.2 without too much trouble.
370388
But when it came time to regenerate the site for Swift 5,
371389
we found ourselves deep in ["dependency hell"][dependency hell]
372-
(something to do with the [regular expression][pcre] library
390+
(something to do with the [regular expression][pcre] library
373391
that Nate had used for the parser).
374-
After begging and pleading with
392+
After begging and pleading with
375393
the spirits possessing our `node_modules` directory to no avail,
376394
we decided to roll up our sleeves and get started on a long-term replacement —
377395
this time, written in Swift.

0 commit comments

Comments
 (0)