Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
cf7ebc6
Add experimental markdown output flag and pass it through to the conv…
Sep 2, 2025
4b1b94a
Initial export of Markdown from Article
Sep 4, 2025
55e7836
Initial processing of a type-level symbol
Sep 4, 2025
53a6196
Adds symbol declarations and article reference links
Sep 5, 2025
3513a73
Output tutorials to markdown
Sep 5, 2025
81d2d5a
Be smarter about removing indentation from within block directives
Sep 5, 2025
f3fa5ab
Baseline for adding new tests for markdown output
Sep 8, 2025
5013a09
Basic test infrastructure for markdown output
Sep 8, 2025
6798162
Adds symbol link tests to markdown output
Sep 8, 2025
132cd6c
Tutoorial code rendering markdown tests
Sep 8, 2025
1753cca
Adding metadata to markdown output
Sep 8, 2025
301d7da
Include package source for markdown output test catalog
Sep 9, 2025
9607e3b
Output metadata updates
Sep 9, 2025
5244f0f
Adds default availability for modules to markdown export
Sep 11, 2025
a6a740e
Move availability out of symbol and in to general metadata for markdo…
Sep 16, 2025
d0dbf44
Refactor markdown output so the final node type is standalone
Sep 19, 2025
595831a
Add generated markdown flag to render node metadata
Sep 23, 2025
104f9eb
Only include unavailable in markdown header if it is true
Sep 23, 2025
a2aa8f1
Initial setup of manifest output, no references
Sep 23, 2025
b5ed559
Output of manifest / relationships
Sep 24, 2025
74b6023
Manifest output format updates
Sep 24, 2025
198d8e8
Remove member symbol relationship
Sep 25, 2025
53ba222
More compact availability, deal with metadata availability for symbols
Sep 26, 2025
af890be
Merge branch 'main' into 159600318/experimental-markdown-ouput
jrturton Sep 26, 2025
4784380
Update tests so all inputs are locally defined
Sep 29, 2025
abc9985
Remove print statements from unused visitors
Oct 2, 2025
edc74da
Merge branch 'main' into 159600318/experimental-markdown-ouput
Oct 2, 2025
eb77d39
Added snippet handling
Oct 2, 2025
0e867d7
Remove or _spi-hide new public API
Oct 2, 2025
f07f683
Remove or _spi-hide new public API (part 2)
Oct 2, 2025
6ccfe8f
Prevent recursion when the abstract of a link contains a link and we …
Nov 6, 2025
4fcd9fe
Test and temporary fix for colspan issue https://github.com/swiftlang…
Nov 20, 2025
ba716ed
Remove separate SwiftDocCMarkdownOutput target
Nov 20, 2025
5c835b0
Bump swift-markdown, remove temporary bug fix
Nov 20, 2025
85ea19b
Merge branch 'main' into 159600318/experimental-markdown-ouput
Nov 20, 2025
43efc75
Updates to handle removed bundle parameter
Nov 20, 2025
8c15b03
Extract common writer code into a helper function
Dec 3, 2025
4bd8267
Clarify use of article.md in test catalog
Dec 3, 2025
4a8b196
Deal with internal links with anchor tags
Dec 3, 2025
fc6cf5c
Deal with unresolved symbol links
Dec 3, 2025
778d33a
Updates to improve public API / clarity of MarkdownOutputNode
Dec 8, 2025
e23115a
Improve public API of manifest, sort contents before writing to preve…
Dec 8, 2025
3659560
Don't use unstructured `Data` for WritableMarkdownOutputNode
Dec 8, 2025
ff960cd
Reduce public SPI surface around markdown writing
Dec 8, 2025
53ae33b
Make relationship subtype a specific type rather than a string
Dec 8, 2025
c0d356c
Make it clear that path component is a fallback title, harden linked …
Dec 8, 2025
a85e59f
Add todos and missing tests
Dec 9, 2025
21c1165
Merge branch 'main' into 159600318/experimental-markdown-ouput
jrturton Dec 9, 2025
293246a
Move markdown output types from public SPI to package
Dec 12, 2025
737be98
Merge branch 'main' into 159600318/experimental-markdown-ouput
Dec 15, 2025
33fa249
don't include scheme or host in documentation links
Dec 15, 2025
9481ccf
Reformat multi-condition if statements
Dec 15, 2025
0df68dd
remove whitespace-only change
Dec 16, 2025
172674c
Remove unused declaration
Dec 16, 2025
8a91913
Remove redundant return types
Dec 16, 2025
f9331f5
Remove MarkdownOutputNodeTranslator
Dec 16, 2025
c9f9131
Add TODO for alternate declarations
Dec 16, 2025
5a4cedf
Add TODO for structural review
Dec 16, 2025
ae69449
Add stacks todo, set writable type back to package
Dec 16, 2025
0a4c251
uri -> identifier
Dec 17, 2025
86e40fa
Use RelationshipsGroup.Kind instead of creating a mirror type
Dec 17, 2025
fcb3734
Merge branch 'main' into 159600318/experimental-markdown-ouput
jrturton Dec 17, 2025
78361eb
Lower access level of manifest, remove children method
Dec 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions Sources/SwiftDocC/Converter/DocumentationContextConverter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,21 @@ public class DocumentationContextConverter {
)
return translator.visit(node.semantic) as? RenderNode
}

/// Converts a documentation node to a markdown node.
/// - Parameters:
/// - node: The documentation node to convert.
/// - Returns: The markdown node representation of the documentation node.
internal func markdownOutput(for node: DocumentationNode) -> CollectedMarkdownOutput? {
guard !node.isVirtual else {
return nil
}

var visitor = MarkdownOutputSemanticVisitor(context: context, node: node)

if let node = visitor.createOutput() {
return CollectedMarkdownOutput(identifier: visitor.identifier, node: node, manifest: visitor.manifest)
}
return nil
}
}
22 changes: 22 additions & 0 deletions Sources/SwiftDocC/Infrastructure/ConvertActionConverter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ package enum ConvertActionConverter {
var assets = [RenderReferenceType : [any RenderReference]]()
var coverageInfo = [CoverageDataEntry]()
let coverageFilterClosure = documentationCoverageOptions.generateFilterClosure()
var markdownManifest = MarkdownOutputManifest(title: context.inputs.displayName, documents: [])

// An inner function to gather problems for errors encountered during the conversion.
//
Expand Down Expand Up @@ -131,6 +132,21 @@ package enum ConvertActionConverter {
return
}

if FeatureFlags.current.isExperimentalMarkdownOutputEnabled,
let markdownConsumer = outputConsumer as? (any ConvertOutputMarkdownConsumer),
let markdownNode = converter.markdownOutput(for: entity)
{
try markdownConsumer.consume(markdownNode: markdownNode.writable)
if FeatureFlags.current.isExperimentalMarkdownOutputManifestEnabled,
let manifest = markdownNode.manifest
{
resultsGroup.async(queue: resultsSyncQueue) {
markdownManifest.documents.formUnion(manifest.documents)
markdownManifest.relationships.formUnion(manifest.relationships)
}
}
}

try outputConsumer.consume(renderNode: renderNode)

switch documentationCoverageOptions.level {
Expand Down Expand Up @@ -235,6 +251,12 @@ package enum ConvertActionConverter {
}
}
}

if FeatureFlags.current.isExperimentalMarkdownOutputManifestEnabled,
let markdownConsumer = outputConsumer as? (any ConvertOutputMarkdownConsumer)
{
try markdownConsumer.consume(markdownManifest: markdownManifest)
}

switch documentationCoverageOptions.level {
case .detailed, .brief:
Expand Down
9 changes: 9 additions & 0 deletions Sources/SwiftDocC/Infrastructure/ConvertOutputConsumer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ public protocol ConvertOutputConsumer {

/// Consumes a file representation of the local link resolution information.
func consume(linkResolutionInformation: SerializableLinkResolutionInformation) throws

}

package protocol ConvertOutputMarkdownConsumer {
/// Consumes a markdown output node
func consume(markdownNode: WritableMarkdownOutputNode) throws

/// Consumes a markdown output manifest
func consume(markdownManifest: MarkdownOutputManifest) throws
}

// Default implementations that discard the documentation conversion products, for consumers that don't need these
Expand Down
Loading