A set of function defining how to format a block into a string (usually a
string of HTML). Each formatter receives three arguments; first, its
contents, already stringified to HTML. For block types without content, such
as the "divider"
type or the "image"
type, an empty string is passed.
For the second argument, the children of the block is passed, as an
already-formatted string of HTML. Again, for block types that cannot have
children, such as a "paragraph"
or "embed"
, an empty string is passed.
Lastly, the third argument represents some contextual information about the
block, such as the previous or next sibling block, its parent, its type, or,
in some cases, some additional information about the specific block. This
is helpful for some block types that are a little less straight-forward to
stringify, such as bulleted list items (since they need to be surrounded by
a <ul>
as a group of siblings) or tables.
bulletedListItem: () => string
numberedListItem: () => string
childDatabase: () => string
breadcrumb: (content: "",children: "",info: BaseBlockInfo<"breadcrumb">,) => string
tableOfContents: (content: "",children: "",info: BaseBlockInfo<"tableOfContents">,) => string
columnList: () => string
linkPreview: () => string