Setting (programming) language availability for articles in Swift-DocC

Hello! I’m here to propose a new feature for Swift-DocC: setting language availability for article content. Right now, Swift-DocC will mark an article as being available for each language that has a symbol in the module, but sometimes this isn’t accurate.

Proposed solution

To resolve this, i would like to add a directive to the page metadata: @SupportedLanguages. This would take one or more language identifiers to tell Swift-DocC that the article is only meant to be appropriate for the given language(s). It would look like this:

@Metadata {
    @SupportedLanguages(swift)
}
@Metadata {
    @SupportedLanguages(swift, objc)
}

This would only be read on articles - it would be ignored on a symbol page. Leaving this out would continue to use Swift-DocC’s current behavior of adding the article to every available language.

Open questions

  • This is meant to hook into the same kind of language identifiers that would come from a symbol graph - hence swift and objc/occ in the sample. How can we make sure this extends to new languages when people make symbol graphs for something other than Swift or Objective-C?
1 Like