Coelho.Schema.MarkSpec (coelho v0.18.0)

Copy Markdown View Source

Specification of a single mark type, such as bold or link.

Fields:

  • :name — the mark name, an atom
  • :attrs — map of attribute name to Coelho.Schema.Attr
  • :class — a CSS class merged into the rendered element and exported to the browser, so the editor shows the class the public page will use
  • :editor_attrs — extra DOM attributes for the editor only, exported with the schema and never emitted server side
  • :code — marks code: the editor lets no typing rule fire on text it covers. Exported to the browser
  • :render — how the mark is turned into HTML, see Coelho.Render
  • :render_untrusted — how it is turned into HTML under policy: :untrusted. A mark with a :safe_url attribute needs none: it is reduced to its text. See Coelho.Render
  • :parse — HTML this mark is imported from, see Coelho.HTML
  • :attr_keys — the attribute names as the strings a document is written in, derived from :attrs when the schema is built

Summary

Types

t()

@type t() :: %Coelho.Schema.MarkSpec{
  attr_keys: MapSet.t(String.t()) | nil,
  attrs: %{optional(atom()) => Coelho.Schema.Attr.t()},
  class: String.t() | nil,
  code: boolean(),
  editor_attrs: %{optional(String.t()) => String.t()},
  name: atom(),
  parse: [Coelho.HTML.rule()],
  render: Coelho.Schema.NodeSpec.render(),
  render_untrusted: Coelho.Schema.NodeSpec.render()
}