> ## Documentation Index
> Fetch the complete documentation index at: https://superdoc-caio-pizzol-docs-ai-core-preset.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# markdownToFragment

> Convert a Markdown string into an SDM/1 structural fragment.

## 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

| Field      | Type   | Required | Description |
| ---------- | ------ | -------- | ----------- |
| `markdown` | string | yes      |             |

### Example request

```json theme={null}
{
  "markdown": "example"
}
```

## Output fields

| Field         | Type      | Required | Description |
| ------------- | --------- | -------- | ----------- |
| `diagnostics` | object\[] | yes      |             |
| `fragment`    | any       | yes      |             |
| `lossy`       | boolean   | yes      |             |

### Example response

```json theme={null}
{
  "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

<Accordion title="Raw input schema">
  ```json theme={null}
  {
    "additionalProperties": false,
    "properties": {
      "markdown": {
        "type": "string"
      }
    },
    "required": [
      "markdown"
    ],
    "type": "object"
  }
  ```
</Accordion>

<Accordion title="Raw output schema">
  ```json theme={null}
  {
    "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"
  }
  ```
</Accordion>
