For inline formatting, sensible fallbacks are set in an attempt to generate somewhat semantic HTML by default. However, each type can be overwritten to allow for completely custom rich text stringification. Technically, it doesn't even need to stringify to HTML.
Due to limitations in the Notion API, it is impossible to support both
text colors as well as background colors for text. As such, text colors
are not supported. The color
formatter refers to text background
colors only. Text colors are ignored, but using them can break
the processing of specified background colors.
All of these are optional; each of them has a fallback. By default, the types are transformed to HTML using the following mapping:
link
becomes<a href=…>
;bold
becomes<strong>
;italic
becomes<em>
;strikethrough
becomes<s>
;underline
becomes<b>
;code
becomes<code>
;color
becomes<mark class=…>
In particular I've chosen underlined text to become <b>
, not <u>
,
because the latter is rarely semantically accurate (or useful, for that
matter) whereas <b>
, the "bring to attention" element, more accurately
represents how I expect most people to use underlined text. To make sure
this is visually reflected in your HTML pages, use font-weight: normal;
together with text-decoration: underline
.
strikethrough: (content: string,info: { },) => string