-
Notifications
You must be signed in to change notification settings - Fork 0
Add support for subscript and superscript #57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -127,7 +127,7 @@ type LayoutWidth = | |
### `Phrasing` | ||
|
||
```ts | ||
type Phrasing = Text | Break | Strong | Emphasis | Strikethrough | Link | ||
type Phrasing = Text | Break | Strong | Emphasis | Strikethrough | Link | Subscript | Superscript | ||
``` | ||
|
||
A phrasing node cannot have ancestor of the same type. | ||
|
@@ -283,6 +283,28 @@ interface Strikethrough extends Parent { | |
|
||
**Strikethrough** represents a piece of text that has been stricken. | ||
|
||
### `Subscript` | ||
|
||
```ts | ||
interface Subscript extends Parent { | ||
type: "subscript" | ||
children: Phrasing[] | ||
} | ||
``` | ||
|
||
**Subscript** represents a piece of text that has a lowered baseline. | ||
|
||
### `Superscript` | ||
|
||
```ts | ||
interface Superscript extends Parent { | ||
type: "superscript" | ||
children: Phrasing[] | ||
} | ||
``` | ||
|
||
**Superscript** represents a piece of text with a raised baseline. | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ☝️ Add support for new subscript ( |
||
### `Link` | ||
|
||
```ts | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
export declare namespace ContentTree { | ||
type BodyBlock = Paragraph | Heading | ImageSet | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | Tweet | Video | YoutubeVideo; | ||
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; | ||
type Phrasing = Text | Break | Strong | Emphasis | Strikethrough | Link | Subscript | Superscript; | ||
interface Node { | ||
type: string; | ||
data?: any; | ||
|
@@ -49,6 +49,14 @@ export declare namespace ContentTree { | |
type: "strikethrough"; | ||
children: Phrasing[]; | ||
} | ||
interface Subscript extends Parent { | ||
type: "subscript"; | ||
children: Phrasing[]; | ||
} | ||
interface Superscript extends Parent { | ||
type: "superscript"; | ||
children: Phrasing[]; | ||
} | ||
interface Link extends Parent { | ||
type: "link"; | ||
url: string; | ||
|
@@ -274,7 +282,7 @@ export declare namespace ContentTree { | |
namespace full { | ||
type BodyBlock = Paragraph | Heading | ImageSet | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | Tweet | Video | YoutubeVideo; | ||
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; | ||
type Phrasing = Text | Break | Strong | Emphasis | Strikethrough | Link | Subscript | Superscript; | ||
interface Node { | ||
type: string; | ||
data?: any; | ||
|
@@ -322,6 +330,14 @@ export declare namespace ContentTree { | |
type: "strikethrough"; | ||
children: Phrasing[]; | ||
} | ||
interface Subscript extends Parent { | ||
type: "subscript"; | ||
children: Phrasing[]; | ||
} | ||
interface Superscript extends Parent { | ||
type: "superscript"; | ||
children: Phrasing[]; | ||
} | ||
interface Link extends Parent { | ||
type: "link"; | ||
url: string; | ||
|
@@ -548,7 +564,7 @@ export declare namespace ContentTree { | |
namespace transit { | ||
type BodyBlock = Paragraph | Heading | ImageSet | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | Tweet | Video | YoutubeVideo; | ||
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; | ||
type Phrasing = Text | Break | Strong | Emphasis | Strikethrough | Link | Subscript | Superscript; | ||
interface Node { | ||
type: string; | ||
data?: any; | ||
|
@@ -596,6 +612,14 @@ export declare namespace ContentTree { | |
type: "strikethrough"; | ||
children: Phrasing[]; | ||
} | ||
interface Subscript extends Parent { | ||
type: "subscript"; | ||
children: Phrasing[]; | ||
} | ||
interface Superscript extends Parent { | ||
type: "superscript"; | ||
children: Phrasing[]; | ||
} | ||
interface Link extends Parent { | ||
type: "link"; | ||
url: string; | ||
|
@@ -809,7 +833,7 @@ export declare namespace ContentTree { | |
namespace loose { | ||
type BodyBlock = Paragraph | Heading | ImageSet | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | Tweet | Video | YoutubeVideo; | ||
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; | ||
type Phrasing = Text | Break | Strong | Emphasis | Strikethrough | Link | Subscript | Superscript; | ||
interface Node { | ||
type: string; | ||
data?: any; | ||
|
@@ -857,6 +881,14 @@ export declare namespace ContentTree { | |
type: "strikethrough"; | ||
children: Phrasing[]; | ||
} | ||
interface Subscript extends Parent { | ||
type: "subscript"; | ||
children: Phrasing[]; | ||
} | ||
interface Superscript extends Parent { | ||
type: "superscript"; | ||
children: Phrasing[]; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ☝️ All changes in this file are autogenerated from changes to README.md. |
||
interface Link extends Parent { | ||
type: "link"; | ||
url: string; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
todo: If I'm not mistaken the json schemas will need to be updated.
For context, the C&M team will allow publishing of content tree next year and those schemas will be our source of truth for validation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The JSON schemas get automatically generated as part of the build step
I think what's missing (and why the JSON schemas haven't been updated yet) is that the new types need to be included as things that can be "Phrasing" - https://github.com/Financial-Times/content-tree/pull/57/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R130
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've just added
Subscript
andSuperscript
to thePhrasing
types, and re-built the schema 👍