Skip to main content
Alpha: Document API is currently alpha and subject to breaking changes.

Summary

Convert a Markdown string into an SDM/1 structural fragment.
  • Operation ID: markdownToFragment
  • API member path: editor.doc.markdownToFragment(...)
  • Mutates document: no
  • Idempotency: idempotent
  • Supports tracked mode: no
  • Supports dry run: no
  • Deterministic target resolution: yes

Expected result

Returns an SDMarkdownToFragmentResult with the converted fragment, lossy flag, and diagnostics.

Input fields

FieldTypeRequiredDescription
markdownstringyes

Example request

{
  "markdown": "example"
}

Output fields

FieldTypeRequiredDescription
diagnosticsobject[]yes
fragmentanyyes
lossybooleanyes

Example response

{
  "diagnostics": [
    {
      "code": "INVALID_TARGET",
      "message": "Operation failed.",
      "path": [
        "example"
      ],
      "severity": "error"
    }
  ],
  "fragment": {},
  "lossy": true
}

Pre-apply throws

  • None

Non-applied failure codes

  • None

Raw schemas

{
  "additionalProperties": false,
  "properties": {
    "markdown": {
      "type": "string"
    }
  },
  "required": [
    "markdown"
  ],
  "type": "object"
}
{
  "additionalProperties": false,
  "properties": {
    "diagnostics": {
      "items": {
        "additionalProperties": false,
        "properties": {
          "code": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "path": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "severity": {
            "enum": [
              "error",
              "warning",
              "info"
            ],
            "type": "string"
          }
        },
        "required": [
          "code",
          "severity",
          "message"
        ],
        "type": "object"
      },
      "type": "array"
    },
    "fragment": {},
    "lossy": {
      "type": "boolean"
    }
  },
  "required": [
    "fragment",
    "lossy",
    "diagnostics"
  ],
  "type": "object"
}