Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
52 changes: 52 additions & 0 deletions SPEC.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,20 @@ type VideoSource = AVSource & {

`VideoSource` extends AVSource to add in the properties relevant just to videos

### `QuestionAndAnswerByline`

```ts
interface QuestionAndAnswerByline extends Node {
type: "question-and-answer-byline"
conceptId: string
title?: string
external displayName: string
external headshotUrl: string
}
```

`QuestionAndAnswerByline` is a byline used for Q&A answers - it carries a `conceptId` to resolve external fields in cp-content-pipeline.

## Core Nodes

### `Node`
Expand Down Expand Up @@ -342,6 +356,9 @@ type StoryBlock =
| Definition
| InfoBox
| InfoPair
| QuestionAndAnswer
| Question
| Answer
```

`StoryBlock` nodes are things that can be inserted into an article body.
Expand Down Expand Up @@ -375,6 +392,41 @@ interface ImageSet extends Node {
}
```

### `QuestionAndAnswer`

```ts
interface QuestionAndAnswer extends Parent {
type: "question-and-answer"
children: [Question, Answer, ...Answer[]]
}
```

`QuestionAndAnswer` defines a container grouping a `Question` followed by one or more `Answer` nodes

### `Question`

```ts
interface Question extends Parent {
type: "question"
displayName?: string
children: (Paragraph | (Text | Break | Strong | Emphasis | Strikethrough))[]
}
```

`Question` defines a Q&A question. Disallows `Link` and `FindOutMoreLink` nodes by explicitly picking the allowed phrasing node types.

### `Answer`

```ts
interface Answer extends Parent {
type: "answer"
byline: QuestionAndAnswerByline
children: (Paragraph | Phrasing)[]
}
```

`Answer` defines an answer to a Q&A Question. Uses `QuestionAndAnswerByline` to display the author.

#### Image types

##### `ImageSetPicture`
Expand Down
90 changes: 86 additions & 4 deletions content-tree.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ export declare namespace ContentTree {
pixelWidth?: number;
videoCodec?: string;
};
interface QuestionAndAnswerByline extends Node {
type: "question-and-answer-byline";
conceptId: string;
title?: string;
displayName: string;
headshotUrl: string;
}
interface Node {
type: string;
data?: any;
Expand Down Expand Up @@ -88,7 +95,7 @@ export declare namespace ContentTree {
type: "blockquote";
children: (Paragraph | Phrasing)[];
}
type StoryBlock = ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | Pullquote | ScrollyBlock | ClipSet | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Timeline | ImagePair | InNumbers | Definition | InfoBox | InfoPair;
type StoryBlock = ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | Pullquote | ScrollyBlock | ClipSet | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Timeline | ImagePair | InNumbers | Definition | InfoBox | InfoPair | QuestionAndAnswer | Question | Answer;
interface Pullquote extends Node {
type: "pullquote";
text: string;
Expand All @@ -100,6 +107,20 @@ export declare namespace ContentTree {
picture: ImageSetPicture;
fragmentIdentifier?: string;
}
interface QuestionAndAnswer extends Parent {
type: "question-and-answer";
children: [Question, Answer, ...Answer[]];
}
interface Question extends Parent {
type: "question";
displayName?: string;
children: (Paragraph | (Text | Break | Strong | Emphasis | Strikethrough))[];
}
interface Answer extends Parent {
type: "answer";
byline: QuestionAndAnswerByline;
children: (Paragraph | Phrasing)[];
}
type ImageSetPicture = {
layoutWidth: string;
imageType: "image" | "graphic";
Expand Down Expand Up @@ -431,6 +452,13 @@ export declare namespace ContentTree {
pixelWidth?: number;
videoCodec?: string;
};
interface QuestionAndAnswerByline extends Node {
type: "question-and-answer-byline";
conceptId: string;
title?: string;
displayName: string;
headshotUrl: string;
}
interface Node {
type: string;
data?: any;
Expand Down Expand Up @@ -507,7 +535,7 @@ export declare namespace ContentTree {
type: "blockquote";
children: (Paragraph | Phrasing)[];
}
type StoryBlock = ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | Pullquote | ScrollyBlock | ClipSet | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Timeline | ImagePair | InNumbers | Definition | InfoBox | InfoPair;
type StoryBlock = ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | Pullquote | ScrollyBlock | ClipSet | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Timeline | ImagePair | InNumbers | Definition | InfoBox | InfoPair | QuestionAndAnswer | Question | Answer;
interface Pullquote extends Node {
type: "pullquote";
text: string;
Expand All @@ -519,6 +547,20 @@ export declare namespace ContentTree {
picture: ImageSetPicture;
fragmentIdentifier?: string;
}
interface QuestionAndAnswer extends Parent {
type: "question-and-answer";
children: [Question, Answer, ...Answer[]];
}
interface Question extends Parent {
type: "question";
displayName?: string;
children: (Paragraph | (Text | Break | Strong | Emphasis | Strikethrough))[];
}
interface Answer extends Parent {
type: "answer";
byline: QuestionAndAnswerByline;
children: (Paragraph | Phrasing)[];
}
type ImageSetPicture = {
layoutWidth: string;
imageType: "image" | "graphic";
Expand Down Expand Up @@ -851,6 +893,11 @@ export declare namespace ContentTree {
pixelWidth?: number;
videoCodec?: string;
};
interface QuestionAndAnswerByline extends Node {
type: "question-and-answer-byline";
conceptId: string;
title?: string;
}
interface Node {
type: string;
data?: any;
Expand Down Expand Up @@ -927,7 +974,7 @@ export declare namespace ContentTree {
type: "blockquote";
children: (Paragraph | Phrasing)[];
}
type StoryBlock = ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | Pullquote | ScrollyBlock | ClipSet | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Timeline | ImagePair | InNumbers | Definition | InfoBox | InfoPair;
type StoryBlock = ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | Pullquote | ScrollyBlock | ClipSet | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Timeline | ImagePair | InNumbers | Definition | InfoBox | InfoPair | QuestionAndAnswer | Question | Answer;
interface Pullquote extends Node {
type: "pullquote";
text: string;
Expand All @@ -938,6 +985,20 @@ export declare namespace ContentTree {
id: string;
fragmentIdentifier?: string;
}
interface QuestionAndAnswer extends Parent {
type: "question-and-answer";
children: [Question, Answer, ...Answer[]];
}
interface Question extends Parent {
type: "question";
displayName?: string;
children: (Paragraph | (Text | Break | Strong | Emphasis | Strikethrough))[];
}
interface Answer extends Parent {
type: "answer";
byline: QuestionAndAnswerByline;
children: (Paragraph | Phrasing)[];
}
type ImageSetPicture = {
layoutWidth: string;
imageType: "image" | "graphic";
Expand Down Expand Up @@ -1244,6 +1305,13 @@ export declare namespace ContentTree {
pixelWidth?: number;
videoCodec?: string;
};
interface QuestionAndAnswerByline extends Node {
type: "question-and-answer-byline";
conceptId: string;
title?: string;
displayName?: string;
headshotUrl?: string;
}
interface Node {
type: string;
data?: any;
Expand Down Expand Up @@ -1320,7 +1388,7 @@ export declare namespace ContentTree {
type: "blockquote";
children: (Paragraph | Phrasing)[];
}
type StoryBlock = ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | Pullquote | ScrollyBlock | ClipSet | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Timeline | ImagePair | InNumbers | Definition | InfoBox | InfoPair;
type StoryBlock = ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | Pullquote | ScrollyBlock | ClipSet | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Timeline | ImagePair | InNumbers | Definition | InfoBox | InfoPair | QuestionAndAnswer | Question | Answer;
interface Pullquote extends Node {
type: "pullquote";
text: string;
Expand All @@ -1332,6 +1400,20 @@ export declare namespace ContentTree {
picture?: ImageSetPicture;
fragmentIdentifier?: string;
}
interface QuestionAndAnswer extends Parent {
type: "question-and-answer";
children: [Question, Answer, ...Answer[]];
}
interface Question extends Parent {
type: "question";
displayName?: string;
children: (Paragraph | (Text | Break | Strong | Emphasis | Strikethrough))[];
}
interface Answer extends Parent {
type: "answer";
byline: QuestionAndAnswerByline;
children: (Paragraph | Phrasing)[];
}
type ImageSetPicture = {
layoutWidth: string;
imageType: "image" | "graphic";
Expand Down
Loading
Loading