@@ -166,7 +166,8 @@ public class OutOfProcessReferenceResolver: ExternalDocumentationSource, GlobalE
166166 url: resolvedInformation. url. path,
167167 kind: kind,
168168 role: role,
169- fragments: resolvedInformation. declarationFragments? . declarationFragments. map { DeclarationRenderSection . Token ( fragment: $0, identifier: nil ) } ,
169+ fragments: resolvedInformation. subHeadingDeclarationFragments? . declarationFragments
170+ . map { DeclarationRenderSection . Token ( fragment: $0, identifier: nil ) } ,
170171 isBeta: resolvedInformation. isBeta,
171172 isDeprecated: ( resolvedInformation. platforms ?? [ ] ) . contains ( where: { $0. deprecated != nil } ) ,
172173 images: resolvedInformation. topicImages ?? [ ]
@@ -182,7 +183,7 @@ public class OutOfProcessReferenceResolver: ExternalDocumentationSource, GlobalE
182183 . init( traits: variant. traits, patch: [ . replace( value: [ . text( abstract) ] ) ] )
183184 )
184185 }
185- if let declarationFragments = variant. declarationFragments {
186+ if let declarationFragments = variant. subHeadingDeclarationFragments {
186187 renderReference. fragmentsVariants. variants. append (
187188 . init( traits: variant. traits, patch: [ . replace( value: declarationFragments? . declarationFragments. map { DeclarationRenderSection . Token ( fragment: $0, identifier: nil ) } ) ] )
188189 )
@@ -577,7 +578,11 @@ extension OutOfProcessReferenceResolver {
577578 public let platforms : [ PlatformAvailability ] ?
578579 /// Information about the resolved declaration fragments, if any.
579580 public let declarationFragments : DeclarationFragments ?
580-
581+ /// Information about the resolved abbreviated declaration fragments, if any.
582+ ///
583+ /// They are used for displaying in contexts where the full declaration fragments would be too verbose, like in the Topics section or the navigation index.
584+ public let subHeadingDeclarationFragments : DeclarationFragments ?
585+
581586 // We use the real types here because they're Codable and don't have public member-wise initializers.
582587
583588 /// Platform availability for a resolved symbol reference.
@@ -620,6 +625,7 @@ extension OutOfProcessReferenceResolver {
620625 /// - availableLanguages: The languages where the resolved node is available.
621626 /// - platforms: The platforms and their versions where the resolved node is available, if any.
622627 /// - declarationFragments: The resolved declaration fragments, if any.
628+ /// - subHeadingDeclarationFragments: The abbreviated resolved declaration fragments, if any.
623629 /// - topicImages: Images that are used to represent the summarized element.
624630 /// - references: References used in the content of the summarized element.
625631 /// - variants: The variants of content for this resolver information.
@@ -632,6 +638,7 @@ extension OutOfProcessReferenceResolver {
632638 availableLanguages: Set < SourceLanguage > ,
633639 platforms: [ PlatformAvailability ] ? = nil ,
634640 declarationFragments: DeclarationFragments ? = nil ,
641+ subHeadingDeclarationFragments: DeclarationFragments ? = nil ,
635642 topicImages: [ TopicImage ] ? = nil ,
636643 references: [ any RenderReference ] ? = nil ,
637644 variants: [ Variant ] ? = nil
@@ -644,6 +651,7 @@ extension OutOfProcessReferenceResolver {
644651 self . availableLanguages = availableLanguages
645652 self . platforms = platforms
646653 self . declarationFragments = declarationFragments
654+ self . subHeadingDeclarationFragments = subHeadingDeclarationFragments
647655 self . topicImages = topicImages
648656 self . references = references
649657 self . variants = variants
@@ -675,7 +683,12 @@ extension OutOfProcessReferenceResolver {
675683 ///
676684 /// If the resolver information has a declaration but the variant doesn't, this property will be `Optional.some(nil)`.
677685 public let declarationFragments : VariantValue < DeclarationFragments ? >
678-
686+ /// The abbreviated declaration fragments of the variant or `nil` if the declaration is the same as the resolved information.
687+ ///
688+ /// They are used for displaying in contexts where the full declaration fragments would be too verbose, like in the Topics section or the navigation index.
689+ /// If the resolver information has a declaration but the variant doesn't, this property will be `Optional.some(nil)`.
690+ public let subHeadingDeclarationFragments : VariantValue < DeclarationFragments ? >
691+
679692 /// Creates a new resolved information variant with the values that are different from the resolved information values.
680693 ///
681694 /// - Parameters:
@@ -686,14 +699,16 @@ extension OutOfProcessReferenceResolver {
686699 /// - abstract: The resolved (plain text) abstract.
687700 /// - language: The resolved language.
688701 /// - declarationFragments: The resolved declaration fragments, if any.
702+ /// - subHeadingDeclarationFragments: The resolved abbreviated declaration fragments, if any.
689703 public init (
690704 traits: [ RenderNode . Variant . Trait ] ,
691705 kind: VariantValue < DocumentationNode . Kind > = nil ,
692706 url: VariantValue < URL > = nil ,
693707 title: VariantValue < String > = nil ,
694708 abstract: VariantValue < String > = nil ,
695709 language: VariantValue < SourceLanguage > = nil ,
696- declarationFragments: VariantValue < DeclarationFragments ? > = nil
710+ declarationFragments: VariantValue < DeclarationFragments ? > = nil ,
711+ subHeadingDeclarationFragments: VariantValue < DeclarationFragments ? > = nil
697712 ) {
698713 self . traits = traits
699714 self . kind = kind
@@ -702,6 +717,7 @@ extension OutOfProcessReferenceResolver {
702717 self . abstract = abstract
703718 self . language = language
704719 self . declarationFragments = declarationFragments
720+ self . subHeadingDeclarationFragments = subHeadingDeclarationFragments
705721 }
706722 }
707723 }
@@ -717,6 +733,7 @@ extension OutOfProcessReferenceResolver.ResolvedInformation {
717733 case availableLanguages
718734 case platforms
719735 case declarationFragments
736+ case subHeadingDeclarationFragments
720737 case topicImages
721738 case references
722739 case variants
@@ -733,6 +750,8 @@ extension OutOfProcessReferenceResolver.ResolvedInformation {
733750 availableLanguages = try container. decode ( Set< SourceLanguage> . self , forKey: . availableLanguages)
734751 platforms = try container. decodeIfPresent ( [ OutOfProcessReferenceResolver . ResolvedInformation . PlatformAvailability ] . self, forKey: . platforms)
735752 declarationFragments = try container. decodeIfPresent ( OutOfProcessReferenceResolver . ResolvedInformation. DeclarationFragments. self, forKey: . declarationFragments)
753+ subHeadingDeclarationFragments = try container
754+ . decodeIfPresent ( OutOfProcessReferenceResolver . ResolvedInformation. DeclarationFragments. self, forKey: . subHeadingDeclarationFragments)
736755 topicImages = try container. decodeIfPresent ( [ TopicImage ] . self, forKey: . topicImages)
737756 references = try container. decodeIfPresent ( [ CodableRenderReference ] . self, forKey: . references) . map { decodedReferences in
738757 decodedReferences. map ( \. reference)
@@ -752,6 +771,7 @@ extension OutOfProcessReferenceResolver.ResolvedInformation {
752771 try container. encode ( self . availableLanguages, forKey: . availableLanguages)
753772 try container. encodeIfPresent ( self . platforms, forKey: . platforms)
754773 try container. encodeIfPresent ( self . declarationFragments, forKey: . declarationFragments)
774+ try container. encodeIfPresent ( self . subHeadingDeclarationFragments, forKey: . subHeadingDeclarationFragments)
755775 try container. encodeIfPresent ( self . topicImages, forKey: . topicImages)
756776 try container. encodeIfPresent ( references? . map { CodableRenderReference ( $0) } , forKey: . references)
757777 try container. encodeIfPresent ( self . variants, forKey: . variants)
0 commit comments