リッチテキストオブジェクト
リッチ テキスト オブジェクト
リッチ テキスト オブジェクトには、Notion が書式設定されたテキスト、メンション、およびインライン式を表示するために使用するデータが含まれています。データベース プロパティ オブジェクトとページ プロパティ値オブジェクト内のリッチ テキスト オブジェクトの配列を使用して、ユーザーが Notion で単一のテキスト値として体験するものを作成します。
リッチ テキスト オブジェクトの例
{
"type": "text",
"text": {
"content": "Some words ",
"link": null
},
"annotations": {
"bold": false,
"italic": false,
"strikethrough": false,
"underline": false,
"code": false,
"color": "default"
},
"plain_text": "Some words ",
"href": null
}
各リッチ テキスト オブジェクトには、次のフィールドが含まれています。
分野 | タイプ | 説明 | 例の値 |
---|---|---|---|
type |
string (列挙型) |
このリッチ テキスト オブジェクトのタイプ。可能なタイプの値は次のとおりです。"text" "mention" "equation" |
"text" |
text |
|||
annotations |
object |
リッチ テキスト オブジェクトのスタイル設定に使用される情報。詳細については、以下の注釈オブジェクトのセクションを参照してください。 | 例については、以下の注釈オブジェクトのセクションを参照してください。 |
plain_text |
string |
注釈なしのプレーン テキスト。 | "Some words " |
href |
string (オプション) |
このテキスト内のリンクまたは Notion に関する言及がある場合は、その URL。 | "https://www.notion.so/Avocado-d093f1d200464ce78b36e58a3f0d8043" |
注釈オブジェクト
すべてのリッチ テキスト オブジェクトには、リッチ テキストのスタイルを設定するannotations
オブジェクトが含まれています。annotations
には次のフィールドが含まれます。
財産 | タイプ | 説明 | 例の値 |
---|---|---|---|
bold |
boolean |
テキストを太字にするかどうか。 | true |
italic |
boolean |
テキストを斜体にするかどうか。 | true |
strikethrough |
boolean |
テキストに取り消し線を引くかどうか。 | false |
underline |
boolean |
テキストに下線を付けるかどうか。 | false |
code |
boolean |
テキストがcode style かどうか。 |
true |
color |
string (列挙型) |
テキストの色。 可能な値は次の とおりです。 -"blue" "blue_background" "brown" "brown_background" "default" "gray" "gray_background" "green" "green_background" "orange" "orange_background" "pink" "pink_background" "purple" "purple_background" "red" "red_background” "yellow" "yellow_background" |
"green" |
リッチテキスト型オブジェクト
方程式
Notion は、"equation"
タイプ値が のリッチ テキスト オブジェクトとしてインライン LaTeX 方程式をサポートします。対応の方程式タイプ オブジェクトには、次のものが含まれます。
分野 | タイプ | 説明 | 例の値 |
---|---|---|---|
expression |
string |
インライン式を表す LaTeX 文字列。 | "\frac{{ - b \pm \sqrt {b^2 - 4ac} }}{{2a}}" |
リッチ テキストequation
オブジェクトの例
JSON
{
"type": "equation",
"equation": {
"expression": "E = mc^2"
},
"annotations": {
"bold": false,
"italic": false,
"strikethrough": false,
"underline": false,
"code": false,
"color": "default"
},
"plain_text": "E = mc^2",
"href": null
}
メンション(言及)
メンション オブジェクトは、データベース、日付、リンク プレビュー メンション、ページ、テンプレート メンション、またはユーザーのインライン メンションを表します。 ユーザーがリファレンスの名前を続けて@
を入力すると、Notion UI にメンションが作成されます 。
リッチ テキスト オブジェクトのtype
値が "mention"
の場合、対応のmention
オブジェクトには次のものが含まれます。
分野 | タイプ | 説明 | 例の値 |
---|---|---|---|
type |
string (列挙型) |
インライン メンションのタイプ。可能な値は次のとおりです。 -"database" "date" "link_preview" "page" "template_mention" "user" |
"user" |
database |
date |
link_preview |
page |
データベース メンション タイプ オブジェクト
データベース メンションには、対応するdatabase
フィールド内のデータベース参照が含まれます 。 データベース参照は、id
キーとデータベース ID に対応するキーと文字列値 (UUIDv4)を持つオブジェクトです 。
インテグレーションが言及されたデータベースにアクセスできない場合、メンションは ID だけで返されます。タイトルとなるplain_text
値は "Untitled"
として表示され、注釈オブジェクトの値はデフォルトです。
database
メンションのリッチ テキストmention
オブジェクトの例
JSON
{
"type": "mention",
"mention": {
"type": "database",
"database": {
"id": "a1d8501e-1ac1-43e9-a6bd-ea9fe6c8822b"
}
},
"annotations": {
"bold": false,
"italic": false,
"strikethrough": false,
"underline": false,
"code": false,
"color": "default"
},
"plain_text": "Database with test things",
"href": "https://www.notion.so/a1d8501e1ac143e9a6bdea9fe6c8822b"
}
日付言及型オブジェクト
日付の言及に は、 対応するdate
フィールド内の 日付プロパティ値オブジェクトが含まれます 。
リッチ テキストmention
オブジェクトのdate
メンション例
JSON
{
"type": "mention",
"mention": {
"type": "date",
"date": {
"start": "2022-12-16",
"end": null
}
},
"annotations": {
"bold": false,
"italic": false,
"strikethrough": false,
"underline": false,
"code": false,
"color": "default"
},
"plain_text": "2022-12-16",
"href": null
}
リンク プレビュー メンション タイプ オブジェクト
ユーザーがリンク プレビューをメンションとして共有することを選択した場合、API はリンク プレビュー メンションを、type
値がlink_preview
のリッチ テキスト オブジェクトとして処理します。リンク プレビューのリッチ テキスト メンションには、リンク プレビュー メンションの作成に使用される url
を含む対応するlink_preview
オブジェクトが含まれます。
リッチ テキストmention
オブジェクトのlink_preview
メンション例
JSON
{
"type": "mention",
"mention": {
"type": "link_preview",
"link_preview": {
"url": "https://workspace.slack.com/archives/C04PF0F9QSD/z1671139297838409?thread_ts=1671139274.065079&cid=C03PF0F9QSD"
}
},
"annotations": {
"bold": false,
"italic": false,
"strikethrough": false,
"underline": false,
"code": false,
"color": "default"
},
"plain_text": "https://workspace.slack.com/archives/C04PF0F9QSD/z1671139297838409?thread_ts=1671139274.065079&cid=C03PF0F9QSD",
"href": "https://workspace.slack.com/archives/C04PF0F9QSD/z1671139297838409?thread_ts=1671139274.065079&cid=C03PF0F9QSD"
}
ページ メンション タイプ オブジェクト
ページ メンションには、対応するpage
フィールド内のページ参照が含まれます 。 ページ参照は、ページ ID に対応するid
プロパティと文字列値 (UUIDv4)を持つオブジェクトです 。
インテグレーションがメンションされたページにアクセスできない場合、メンションは ID だけで返されます。タイトルとなるplain_text
値は "Untitled"
として表示され、注釈オブジェクトの値はデフォルトです。
リッチ テキストmention
オブジェクトのpage
メンション例
JSON
{
"type": "mention",
"mention": {
"type": "page",
"page": {
"id": "3c612f56-fdd0-4a30-a4d6-bda7d7426309"
}
},
"annotations": {
"bold": false,
"italic": false,
"strikethrough": false,
"underline": false,
"code": false,
"color": "default"
},
"plain_text": "This is a test page",
"href": "https://www.notion.so/3c612f56fdd04a30a4d6bda7d7426309"
}
テンプレート メンション タイプ オブジェクト
Notion UI のテンプレート ボタン内のコンテンツには、プレースホルダーの日付と、テンプレートが複製されたときに入力されるユーザー メンションを含めることができます。テンプレート メンション タイプ オブジェクトには、これらの設定された値が含まれます。
テンプレート メンション リッチ テキスト オブジェクトには、 "template_mention_date"
または "template_mention_user"
のいずれ か のネストされた type
キーを 持つオtemplate_mention
ブジェクトが含まれます。
type
キーが "template_mention_date"
の 場合 、リッチ テキスト オブジェクトには次のtemplate_mention_date
フィールドが含まれます。
分野 | タイプ | 説明 | 例の値 |
---|---|---|---|
template_mention_date |
string (列挙型) |
日付言及のタイプ。可能な値は 次のとおり です。"today" "now" |
"today" |
リッチ テキストmention
オブジェクトのtemplate_mention_date
メンション例
JSON
{
"type": "mention",
"mention": {
"type": "template_mention",
"template_mention": {
"type": "template_mention_date",
"template_mention_date": "today"
}
},
"annotations": {
"bold": false,
"italic": false,
"strikethrough": false,
"underline": false,
"code": false,
"color": "default"
},
"plain_text": "@Today",
"href": null
}
タイプ キーが"template_mention_user"
の場合 、リッチ テキスト オブジェクトには次のtemplate_mention_user
フィールドが含まれます。
分野 | タイプ | 説明 | 例の値 |
---|---|---|---|
template_mention_user |
string (列挙型) |
ユーザー メンションのタイプ。可能な値は だけです 。"me" |
"me" |
リッチ テキストmention
オブジェクトのtemplate_mention_user
メンション例
JSON
{
"type": "mention",
"mention": {
"type": "template_mention",
"template_mention": {
"type": "template_mention_user",
"template_mention_user": "me"
}
},
"annotations": {
"bold": false,
"italic": false,
"strikethrough": false,
"underline": false,
"code": false,
"color": "default"
},
"plain_text": "@Me",
"href": null
}
ユーザー メンション タイプ オブジェクト
リッチ テキスト オブジェクトのtype
値が "user"
の場合、対応するユーザー フィールドには ユーザー オブジェクトが含まれます。
📘
インテグレーションがまだ前述のユーザーにアクセスできない場合、ユーザーの名前を含む
plain_text
は"@Anonymous"
として読み取られます。ユーザーにアクセスできるように統合を更新するには、統合設定ページで統合機能を更新します。
リッチ テキストmention
オブジェクトのuser
メンション例
JSON
{
"type": "mention",
"mention": {
"type": "user",
"user": {
"object": "user",
"id": "b2e19928-b427-4aad-9a9d-fde65479b1d9"
}
},
"annotations": {
"bold": false,
"italic": false,
"strikethrough": false,
"underline": false,
"code": false,
"color": "default"
},
"plain_text": "@Anonymous",
"href": null
}
テキスト
リッチ テキスト オブジェクトのtype
値が"text"
の場合、対応するtext
フィールドには次のようなオブジェクトが含まれます。
分野 | タイプ | 説明 | 例の値 |
---|---|---|---|
content |
string |
テキストの実際のテキスト コンテンツ。 | "Some words " |
link |
object (オプション) |
含まれている場合、このテキスト内のインライン リンクに関する情報を含むオブジェクト。 テキストにインライン リンクが含まれている場合、オブジェクト キーは url で、値は URL の文字列 Web アドレスです。テキストにインライン リンクがない場合、値は null です。 |
{ "url": "https://developers.notion.com/" } |
リンクのないリッチ テキストtext
オブジェクトの例
JSON
{
"type": "text",
"text": {
"content": "This is an ",
"link": null
},
"annotations": {
"bold": false,
"italic": false,
"strikethrough": false,
"underline": false,
"code": false,
"color": "default"
},
"plain_text": "This is an ",
"href": null
}
リンク付きのリッチテキストtext
オブジェクトの例
JSON
{
"type": "text",
"text": {
"content": "inline link",
"link": {
"url": "https://developers.notion.com/"
}
},
"annotations": {
"bold": false,
"italic": false,
"strikethrough": false,
"underline": false,
"code": false,
"color": "default"
},
"plain_text": "inline link",
"href": "https://developers.notion.com/"
}
📘リッチ テキスト オブジェクトの制限
リッチ テキスト オブジェクトのサイズ制限については、リクエスト制限のドキュメント ページを参照してください。