| | |
| | | return |
| | | } |
| | | |
| | | // find first line |
| | | const firstChild = node.children[0] |
| | | // find first line and callout content |
| | | const [firstChild, ...calloutContent] = node.children |
| | | if (firstChild.type !== "paragraph" || firstChild.children[0]?.type !== "text") { |
| | | return |
| | | } |
| | |
| | | "data-callout-metadata": calloutMetaData, |
| | | }, |
| | | } |
| | | |
| | | // Add callout-content class to callout body if it has one. |
| | | if (calloutContent.length > 0) { |
| | | const contentData: BlockContent | DefinitionContent = { |
| | | data: { |
| | | hProperties: { |
| | | className: "callout-content", |
| | | }, |
| | | hName: "div", |
| | | }, |
| | | type: "blockquote", |
| | | children: [...calloutContent], |
| | | } |
| | | node.children = [node.children[0], contentData] |
| | | } |
| | | } |
| | | }) |
| | | } |