# Text conflict render

`text-conflict-render` · version 1.0.0 · Text · free, no key needed

Render text and conflict parts as merge or diff3 conflict-marker text.

**Use when you need to: text conflict render · render conflict marker blocks · emit merge or diff3 conflict text.**

## Supported

- text conflict render
- render conflict marker blocks
- emit merge or diff3 conflict text

## Not supported

- nested conflict markers
- preserve marker CR/LF
- git mergetool filesystem access
- unicode normalization
- fuzzy matching

## Behavior

- parts is an array of {type:"text", text} or {type:"conflict", ours, theirs} objects. Unknown keys on a part are rejected.
- marker_style merge (default) allows conflict keys type, ours, theirs only; a base key is rejected. diff3 requires base.
- Text parts are copied verbatim. Conflict parts emit LF marker lines: <<<<<<< ours_label, optional ||||||| base_label, =======, >>>>>>> theirs_label.
- Nonempty ours, theirs, or base that does not already end with LF gets a trailing LF before the next marker. Empty sides stay empty.
- Labels default to ours, theirs, and base. Labels are nonempty, at most 256 UTF-8 bytes, and must not contain CR or LF.
- Well-formed parts whose conflict inner texts already use LF line endings round-trip with text-conflict-parse.

## Input

- `parts` (array of object, required)
- `marker_style` (one of "merge", "diff3", optional)
- `ours_label` (string, optional): min length 1; max length 256
- `theirs_label` (string, optional): min length 1; max length 256
- `base_label` (string, optional): min length 1; max length 256

## Output

- `text` (string, required): max length 1048576

## Limits

- max text bytes: 262144
- max label bytes: 256
- max output bytes: 1048576

## Example

Request input:

```json
{
  "parts": [
    {
      "type": "text",
      "text": "keep\n"
    },
    {
      "type": "conflict",
      "ours": "aaa\n",
      "theirs": "bbb\n"
    }
  ]
}
```

Response:

```json
{
  "result": {
    "text": "keep\n<<<<<<< ours\naaa\n=======\nbbb\n>>>>>>> theirs\n"
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "text-conflict-render",
  "version": "1.0.0",
  "input": {
    "parts": [
      {
        "type": "text",
        "text": "keep\n"
      },
      {
        "type": "conflict",
        "ours": "aaa\n",
        "theirs": "bbb\n"
      }
    ]
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/text-conflict-render/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"parts":[{"type":"text","text":"keep\n"},{"type":"conflict","ours":"aaa\n","theirs":"bbb\n"}]}'
```

The machine-readable contract is at [/v1/tools/text-conflict-render/versions/1.0.0](/v1/tools/text-conflict-render/versions/1.0.0).

### CLI

```sh
node cli.mjs run text-conflict-render 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [Text conflict parse](/tools/text-conflict-parse): Parse merge or diff3 conflict-marker text into ordered text and conflict parts.
- [Text three way merge](/tools/text-three-way-merge): Three-way merge of text line records with merge or diff3 conflict markers.
- [Text indentation detect](/tools/text-indentation-detect): Detect whether a text uses tabs or spaces for indentation by counting lines.
- [Text unified diff](/tools/text-unified-diff): Emit a one-file unified diff of two texts with comma counts and LF document breaks.
- [Text apply unified patch](/tools/text-apply-unified-patch): Apply a one-file unified patch to text at original line addresses with exact hunk matches.
- [Text control characters find](/tools/text-control-characters-find): Find non-whitespace control characters in a text string.
