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
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ type BodyBlock =
| YoutubeVideo
| Text
| ImagePair
| Comparison
```

`BodyBlock` nodes are the only things that are valid as the top level of a `Body`.
Expand Down Expand Up @@ -699,6 +700,17 @@ interface LayoutImage extends Node {
this was that in the bodyXML, layout nodes were inside an `<experimental>`
tag, and that didn't support publishing `<ft-content>`.

### Card
```ts
interface Card extends Parent {
type: "card"
title?: string
children: [ImageSet, ...Paragraph[]] | [Paragraph, ...Paragraph[]]
}
```

A card describes a subject typically with an image and a description. It can be an imageset on its own, an image folllowed by one or more paragraphs, or one or more paragraphs on their own.

### `Table`

```ts
Expand Down Expand Up @@ -799,6 +811,18 @@ interface ImagePair extends Parent {

**ImagePair** is a set of two images

### Comparison

```ts
interface Comparison extends Parent {
type: 'comparison'
title?: string
children: [Card, Card]
}
```

A comparison has 2 cards adjacent to each other

## License

This software is published by the Financial Times under the [MIT licence](mit).
Expand Down
48 changes: 44 additions & 4 deletions content-tree.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export declare namespace ContentTree {
type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Text | ImagePair;
type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Text | ImagePair | Comparison;
type LayoutWidth = "auto" | "in-line" | "inset-left" | "inset-right" | "full-bleed" | "full-grid" | "mid-grid" | "full-width";
type Phrasing = Text | Break | Strong | Emphasis | Strikethrough | Link;
interface Node {
Expand Down Expand Up @@ -227,6 +227,11 @@ export declare namespace ContentTree {
credit: string;
picture: ImageSetPicture;
}
interface Card extends Parent {
type: "card";
title?: string;
children: [ImageSet, ...Paragraph[]] | [Paragraph, ...Paragraph[]];
}
type TableColumnSettings = {
hideOnMobile: boolean;
sortable: boolean;
Expand Down Expand Up @@ -289,8 +294,13 @@ export declare namespace ContentTree {
type: 'image-pair';
children: [ImageSet, ImageSet];
}
interface Comparison extends Parent {
type: 'comparison';
title?: string;
children: [Card, Card];
}
namespace full {
type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Text | ImagePair;
type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Text | ImagePair | Comparison;
type LayoutWidth = "auto" | "in-line" | "inset-left" | "inset-right" | "full-bleed" | "full-grid" | "mid-grid" | "full-width";
type Phrasing = Text | Break | Strong | Emphasis | Strikethrough | Link;
interface Node {
Expand Down Expand Up @@ -518,6 +528,11 @@ export declare namespace ContentTree {
credit: string;
picture: ImageSetPicture;
}
interface Card extends Parent {
type: "card";
title?: string;
children: [ImageSet, ...Paragraph[]] | [Paragraph, ...Paragraph[]];
}
type TableColumnSettings = {
hideOnMobile: boolean;
sortable: boolean;
Expand Down Expand Up @@ -580,9 +595,14 @@ export declare namespace ContentTree {
type: 'image-pair';
children: [ImageSet, ImageSet];
}
interface Comparison extends Parent {
type: 'comparison';
title?: string;
children: [Card, Card];
}
}
namespace transit {
type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Text | ImagePair;
type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Text | ImagePair | Comparison;
type LayoutWidth = "auto" | "in-line" | "inset-left" | "inset-right" | "full-bleed" | "full-grid" | "mid-grid" | "full-width";
type Phrasing = Text | Break | Strong | Emphasis | Strikethrough | Link;
interface Node {
Expand Down Expand Up @@ -803,6 +823,11 @@ export declare namespace ContentTree {
caption: string;
credit: string;
}
interface Card extends Parent {
type: "card";
title?: string;
children: [ImageSet, ...Paragraph[]] | [Paragraph, ...Paragraph[]];
}
type TableColumnSettings = {
hideOnMobile: boolean;
sortable: boolean;
Expand Down Expand Up @@ -857,9 +882,14 @@ export declare namespace ContentTree {
type: 'image-pair';
children: [ImageSet, ImageSet];
}
interface Comparison extends Parent {
type: 'comparison';
title?: string;
children: [Card, Card];
}
}
namespace loose {
type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Text | ImagePair;
type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Text | ImagePair | Comparison;
type LayoutWidth = "auto" | "in-line" | "inset-left" | "inset-right" | "full-bleed" | "full-grid" | "mid-grid" | "full-width";
type Phrasing = Text | Break | Strong | Emphasis | Strikethrough | Link;
interface Node {
Expand Down Expand Up @@ -1087,6 +1117,11 @@ export declare namespace ContentTree {
credit: string;
picture?: ImageSetPicture;
}
interface Card extends Parent {
type: "card";
title?: string;
children: [ImageSet, ...Paragraph[]] | [Paragraph, ...Paragraph[]];
}
type TableColumnSettings = {
hideOnMobile: boolean;
sortable: boolean;
Expand Down Expand Up @@ -1149,5 +1184,10 @@ export declare namespace ContentTree {
type: 'image-pair';
children: [ImageSet, ImageSet];
}
interface Comparison extends Parent {
type: 'comparison';
title?: string;
children: [Card, Card];
}
}
}
80 changes: 80 additions & 0 deletions schemas/body-tree.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@
},
{
"$ref": "#/definitions/ContentTree.transit.ImagePair"
},
{
"$ref": "#/definitions/ContentTree.transit.Comparison"
}
]
},
Expand All @@ -145,6 +148,83 @@
],
"type": "object"
},
"ContentTree.transit.Card": {
"additionalProperties": false,
"properties": {
"children": {
"anyOf": [
{
"additionalItems": {
"$ref": "#/definitions/ContentTree.transit.Paragraph"
},
"items": [
{
"$ref": "#/definitions/ContentTree.transit.ImageSet"
}
],
"minItems": 1,
"type": "array"
},
{
"additionalItems": {
"$ref": "#/definitions/ContentTree.transit.Paragraph"
},
"items": [
{
"$ref": "#/definitions/ContentTree.transit.Paragraph"
}
],
"minItems": 1,
"type": "array"
}
]
},
"data": {},
"title": {
"type": "string"
},
"type": {
"const": "card",
"type": "string"
}
},
"required": [
"children",
"type"
],
"type": "object"
},
"ContentTree.transit.Comparison": {
"additionalProperties": false,
"properties": {
"children": {
"items": [
{
"$ref": "#/definitions/ContentTree.transit.Card"
},
{
"$ref": "#/definitions/ContentTree.transit.Card"
}
],
"maxItems": 2,
"minItems": 2,
"type": "array"
},
"data": {},
"title": {
"type": "string"
},
"type": {
"const": "comparison",
"type": "string"
}
},
"required": [
"children",
"type"
],
"type": "object"
},
"ContentTree.transit.CustomCodeComponent": {
"additionalProperties": false,
"properties": {
Expand Down
80 changes: 80 additions & 0 deletions schemas/content-tree.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@
},
{
"$ref": "#/definitions/ContentTree.full.ImagePair"
},
{
"$ref": "#/definitions/ContentTree.full.Comparison"
}
]
},
Expand All @@ -170,6 +173,83 @@
],
"type": "object"
},
"ContentTree.full.Card": {
"additionalProperties": false,
"properties": {
"children": {
"anyOf": [
{
"additionalItems": {
"$ref": "#/definitions/ContentTree.full.Paragraph"
},
"items": [
{
"$ref": "#/definitions/ContentTree.full.ImageSet"
}
],
"minItems": 1,
"type": "array"
},
{
"additionalItems": {
"$ref": "#/definitions/ContentTree.full.Paragraph"
},
"items": [
{
"$ref": "#/definitions/ContentTree.full.Paragraph"
}
],
"minItems": 1,
"type": "array"
}
]
},
"data": {},
"title": {
"type": "string"
},
"type": {
"const": "card",
"type": "string"
}
},
"required": [
"children",
"type"
],
"type": "object"
},
"ContentTree.full.Comparison": {
"additionalProperties": false,
"properties": {
"children": {
"items": [
{
"$ref": "#/definitions/ContentTree.full.Card"
},
{
"$ref": "#/definitions/ContentTree.full.Card"
}
],
"maxItems": 2,
"minItems": 2,
"type": "array"
},
"data": {},
"title": {
"type": "string"
},
"type": {
"const": "comparison",
"type": "string"
}
},
"required": [
"children",
"type"
],
"type": "object"
},
"ContentTree.full.CustomCodeComponent": {
"additionalProperties": false,
"properties": {
Expand Down
Loading
Loading