View Source CFSync.RichText (CFSync v0.10.0)

RichText recursive struct

RichText in Contentful is implemented as a tree of nodes. All nodes share a common structure and some of them have specific properties. Here I chosed to represent all nodes with a single struct for simplicity.

Link to this section Summary

Link to this section Types

@type marks() :: :bold | :italic | :underline | :code
@type node_types() ::
  :document
  | :paragraph
  | :heading_1
  | :heading_2
  | :heading_3
  | :heading_4
  | :heading_5
  | :heading_6
  | :ol_list
  | :ul_list
  | :list_item
  | :hr
  | :quote
  | :embedded_entry
  | :embedded_asset
  | :table
  | :table_row
  | :table_cell
  | :table_header_cell
  | :hyperlink
  | :entry_hyperlink
  | :asset_hyperlink
  | :embedded_entry_inline
  | :text
@type t() :: %CFSync.RichText{
  colspan: integer(),
  content: [t()],
  marks: [marks()],
  rowspan: integer(),
  target: nil | CFSync.Link.t(),
  type: node_types(),
  uri: nil | binary(),
  value: binary()
}

Link to this section Functions

@spec new(:empty | map()) :: t()