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
Copy file name to clipboardExpand all lines: Sources/SwiftDocC/SwiftDocC.docc/SwiftDocC/CompilerPipeline.md
+16-14Lines changed: 16 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -6,23 +6,24 @@ Get to know the steps involved in documentation compilation.
6
6
7
7
This article describes the discrete and sequential steps of compiling documentation with DocC.
8
8
9
-
DocC starts with content discovery by parsing the documentation sources in your documentation bundle. Next, it validates and semantically analyzes them and then builds an in-memory model of the compiled documentation. Once the in-memory model is finalized, DocC converts each topic into a persistable representation it can store on disk.
10
-
11
-
To use the compiled documentation, either query the in-memory model directly or convert its nodes to their render-friendly representation. For example, the `SwiftDocCUtilities` framework enumerates all the nodes in DocC's in-memory model, converts each node for rendering, and finally writes the complete documentation to the disk.
9
+
DocC starts with input discovery by categorizing the documentation sources in your documentation catalog. Next, it loads and parses the those inputs to create in-memory models of the documentation pages. Once the in-memory model is finalized, DocC converts each topic into a persistable render-friendly representation it can store on disk.
12
10
13
11
### Discovery
14
12
15
-
DocC starts discovery by creating a ``DocumentationWorkspace`` to interact with the file system and a ``DocumentationContext`` that manages the in-memory model for the built documentation.
13
+
DocC starts by creating a ``DocumentationContext/InputsProvider`` to discover the inputs from the user-provided command line arguments. These inputs are:
16
14
17
-
When a documentation bundle is found in the workspace by a ``DocumentationWorkspaceDataProvider``, the following files are recognized and processed (others are ignored):
15
+
- Markup files, tutorial files, and assets (for example images)
16
+
- Symbol graph files, describing the symbols in a given module (types, functions, variables, etc.) and their relationships (inheritance, conformance, etc.)
17
+
- Meta information about this "unit" of documentation (for example a custom display name)
18
+
- Customizations to the render template.
18
19
19
-
- An `Info.plist` file containing meta information like the bundle display name.
20
-
- Symbol-graph files with the `.symbols.json` extension.
21
-
- Authored markup files with an `.md` extension
22
-
- Authored tutorial files with a `.tutorial` extension
23
-
- Additional documentation assets with known extensions like `.png`, `.jpg`, `.mov`, and `.zip`.
20
+
Markup, tutorials, assets, and render-template-customization can only be discovered as files inside of a documentation catalog (`.docc` directory).
21
+
Symbol graph files can either be discovered as files inside of a documentation catalog or as additional files provided via user-provided command line arguments.
22
+
Meta information can either be discovered from an optional top-level `Info.plist` file inside of a documentation catalog or as provided values via user-provided command line arguments. All meta information is optional.
24
23
25
-
You can organize the files in any way, as long as `Info.plist` is in the root of the directory tree. Here is an example of a bundle, that groups topic files in logical groups with an additional directory for shared asset files:
24
+
You can organize the files inside the documentation catalog according to your preference,
25
+
as long as the optional `Info.plist`--containing optional meta information--and the optional render customization files are top-level.
26
+
For example, this catalog groups files based on their topic with an additional directory for shared asset files:
26
27
27
28
```none
28
29
SwiftDocC.docc
@@ -45,9 +46,10 @@ SwiftDocC.docc
45
46
46
47
### Analysis and Registration
47
48
48
-
This phase starts with registering all symbols from the available symbol graphs into a documentation *topic graph* in memory.
49
+
This phase starts with creating a ``DocumentationContext`` using the discovered inputs from the previous phase.
50
+
This begins loading and registering the inputs with the context.
49
51
50
-
The symbol graph filesare machine generated and describe all available symbols in a framework (types, functions, variables, etc.) and their relationships, for example, inheritance and conformance.
52
+
The first input that the context register is the symbol information. The symbol information comes from "symbol graph files" which are machine generated and describe all available symbols in a framework (types, functions, variables, etc.) and their relationships (inheritance, conformance, etc.).
51
53
52
54
Each symbol becomes a documentation node in the topic graph and thus a documentation *topic* (an entity in the documentation model). The symbol's topic could optionally be extended with authored documentation from a markup file.
53
55
@@ -57,7 +59,7 @@ Next, all the remaining markup files are analyzed and converted to documents (fo
57
59
58
60
Finally, if you reference any symbols from another framework, and DocC knows how to resolve those, the symbols are fetched and added to the graph too.
59
61
60
-
### Curation
62
+
####Curation
61
63
62
64
At this point the in-memory topic graph accurately represents the machine generated description of the documented framework. However, documentation is often better consumed when it's curated into logical groups and into an incremental learning experience.
Learn how to discover documentation inputs on the file system.
4
+
5
+
## Discussion
6
+
7
+
A ``DocumentationContext/InputsProvider`` discovers documentation catalogs on the file system and creates a ``DocumentationBundle`` from the discovered catalog content.
8
+
9
+
```swift
10
+
let inputProvider = DocumentationContext.InputsProvider(fileManager: fileSystem)
0 commit comments