Thank you for posting this interesting pitch. I have a number of questions that I'll group into four categories: "use cases", "where it's supported", "syntax", and "JSON representation".
Use cases
I feel that what's mostly missing from this pitch is a description of what problem this is solving. I'm hoping that by talking about the use cases, we can find and formulate what that problem is. To that end;
Can you give some examples of what you think that developers would use this @Card directive for?
Regarding the first "Hello World" example, that doesn't have a header. To me this looks quite similar to an aside (except that it doesn't have a "note"/"warning" title). Can you think of any examples where developers would go for a @Card directive without a header instead of an aside? Alternatively, if DocC were to add documentation to help developers decide between an aside and a @Card directive without a header; are there any key guiding questions (for the documentation to ask of the developer) that you can think of that would help steer them in one direction or the other?
Regarding the third "Build with speed and performance" example. I know that that specific text and code comes from the swift.org landing page but if we ignore the specific text and content;
What types of pages do you think are most likely to use a long @Card directive like that—with both a titled header, a couple of paragraphs of text, and maybe a code block or an image—and how does that card content fit in with the text before and after it on the rendered page?
I'm thinking of this tip from DocC's documentation about writing asides (quoted below) and how some of those same issues of interrupting the flow of the surrounding text and looking more visually heavy could apply to long Card directives as well:
If you have much information to provide about a subtopic, consider using a subsection rather than a multi-paragraph aside. This can help with the flow of the text and make the information appear less visually heavy on the page.
Assuming that cards that cover subtopics that are too long would eventually be a better fit for a subsection; where do you think that the balance is between a quick callout in an aside, a medium-length(?) Card directive, and a full subsection?
Do you think that developers will convert some of their existing aides into @Card directives, and if so what do you think would be the primary reason to do so?
For example, I find it a bit ironic that in this pitch so far
@Card {
To be, or not to be
}
would be visually represented closer to how developers expect a block quote to be displayed than how > To be, or not to be is displayed today.
I would consider it a failure if people switch to using @Card directives for quotes and other callouts as a workaround to avoid displaying the aside kind ("Note", "Warning", etc.). I wonder if the use cases for the header-less @Card directives could really be an indication of use cases where developer would like to avoid displaying the aside kind on the rendered page.
Similarly, I wonder if there are use cases where a developer would want to display a heading—with a slightly more emphasized background color—with a title and summary in an aside that for examples warns about one or more situations to be careful about (a warning aside) or that provides recommendations (a tip aside) or similar.
Where it's supported
Have I understood correctly that this first sentence (emphasis mine):
[...] which can be used to group and highlight related blocks of content within an article.
is proposing that DocC will only support this new @Card directive in articles and that it won't support it in either Tutorial documentation or in symbol documentation (regardless if the content comes from an in-source documentation comment or from a documentation extension file)?
Syntax
The questions I have about the syntax mostly relate to the possible use cases and the potential overlap with asides. Most of those questions in one way or another lead to the broader question: have you considered extending asides with these same capabilities (not displaying the aside name and having an optional heading)? If that was a consideration, can you describe why the proposed Card directive solves "the problem" (which the use cases above hopefully helped formalize) better?
For example, if DocC supported asides that don't display the aside kind; do you think that there would be the same need to support header-less @Card directives?
Alternatively, if DocC supported optional headers in asides—and hypothetically the @Card directive as well—when do you think a developer would reach for one or the other?
Regardless of the broader syntax discussion (a new directive or enhanced asides); one detail that struck me as a bit odd in the examples in this pitch was that both examples with a heading use a level-3 heading. Can you share some details about why they use that specific heading level? Would a level-1 heading appear too large on the page? Part of me feels that this makes the directive scope feels less isolated from the content around it but at the same time I can appreciate the simplicity of keeping the element formatted the same both inside and outside the card scope.
Unless I've misunderstood the JSON specification; it doesn't support formatted heading text. If that's correct, have you considered using a directive argument for the card's title/heading? That could avoid some confusion around what level of heading developers should choose for their title.
@Card(title: "This is a heading") {
More heading content
---
This content is the main body of the card.
Here is some more body content.
}
A similar concept could be expressed in an aside (using some hypothetical straw man syntax):
> Card: This is a heading
>
> More heading content
>
> ---
>
> This content is the main body of the card.
>
> Here is some more body content.
That said, if some developers have a reason to use very long titles that would look too large as a level-3 heading; perhaps it's worthwhile to maintain the flexibility of allowing them to use a level-4 or level-5 heading for the title of that card.
JSON representation
In addition to the developer facing syntax, the other piece that's really difficult to change once it's merged is the way that the page information is represented in the JSON that DocC creates and DocC Render reads. Can you share how you think that this card content should be represented in the JSON?
Also, can you think of any possible future additions to the @Card directive that would require a change to that JSON representation? If there are any remotely possible enhancements then it would be good to ensure that we can make those changes in the future without requiring breaking changes to the JSON representation. For example, what if in the future cards gained a (third) footer section?