Recent searches

in

source_key

On this page

This key defines the key that the parser should look for in the source text.

This only needs to be set if it differs from the editor_key.

Appears in

└── Snippet Model
    └── source_key

Type

string

Examples

Copied to clipboard
parser: key_values
options:
  models:
    - source_key: href
      editor_key: link
    - source_key: target
      editor_key: link_target
    - source_key: class
      editor_key: classnames
{
  "parser": "key_values",
  "options": {
    "models": [
      {
        "source_key": "href",
        "editor_key": "link"
      },
      {
        "source_key": "target",
        "editor_key": "link_target"
      },
      {
        "source_key": "class",
        "editor_key": "classnames"
      }
    ]
  }
}

Key/value models can be specified in any order, so do not have to match the order of they keys in the source code.

Example usage:

Markdown
Copied to clipboard
## My blog post

<a href="#link" target="_blank" class="my_link"> ... </a>
Morbi leo risus, porta ac consectetur ac, vestibulum at eros.

When edited in CloudCannon, this will edit as the data model:

Copied to clipboard
link: '#link'
link_target: _blank
classnames: my_link
{
  "link": "#link",
  "link_target": "_blank",
  "classnames": "my_link"
}
Open in a new tab