# @mwillbanks/tuil-content

Source: /tuil/docs/reference/packages/content
Locale: en

Shared Markdown code diff JSON structured-content projections and selection models for tuil.



## Overview [#overview]

Shared Markdown code diff JSON structured-content projections and selection models for tuil.

`@mwillbanks/tuil-content` is independently installable and also participates in the
umbrella `@mwillbanks/tuil` runtime where applicable.

## Installation [#installation]

<CodeBlockTabs defaultValue="npm">
  <CodeBlockTabsList>
    <CodeBlockTabsTrigger value="npm">
      npm
    </CodeBlockTabsTrigger>

    <CodeBlockTabsTrigger value="pnpm">
      pnpm
    </CodeBlockTabsTrigger>

    <CodeBlockTabsTrigger value="yarn">
      yarn
    </CodeBlockTabsTrigger>

    <CodeBlockTabsTrigger value="bun">
      bun
    </CodeBlockTabsTrigger>
  </CodeBlockTabsList>

  <CodeBlockTab value="npm">
    ```bash
    npm install @mwillbanks/tuil-content
    ```
  </CodeBlockTab>

  <CodeBlockTab value="pnpm">
    ```bash
    pnpm add @mwillbanks/tuil-content
    ```
  </CodeBlockTab>

  <CodeBlockTab value="yarn">
    ```bash
    yarn add @mwillbanks/tuil-content
    ```
  </CodeBlockTab>

  <CodeBlockTab value="bun">
    ```bash
    bun add @mwillbanks/tuil-content
    ```
  </CodeBlockTab>
</CodeBlockTabs>

## How it operates [#how-it-operates]

Content models retain structured paths and diff source positions while exposing raw, tree, table, unified, and split projections.

<Mermaid
  chart="flowchart LR
  S0[&#x22;parse model&#x22;]
  S1[&#x22;navigate/search&#x22;]
  S2[&#x22;select/copy&#x22;]
  S3[&#x22;project&#x22;]
  S0 --> S1
  S1 --> S2
  S2 --> S3"
/>

## API [#api]

| API                                                                                       | Signature                      | Description                          |
| ----------------------------------------------------------------------------------------- | ------------------------------ | ------------------------------------ |
| [`resolveJsonPath`](/tuil/docs/reference/packages/content/api/resolve-json-path)               | `function resolveJsonPath`     | Public function resolveJsonPath.     |
| [`StructuredContentModel`](/tuil/docs/reference/packages/content/api/structured-content-model) | `class StructuredContentModel` | Public class StructuredContentModel. |
| [`TreeRow`](/tuil/docs/reference/packages/content/api/tree-row)                                | `interface TreeRow`            | Public interface TreeRow.            |

## Events and lifecycle [#events-and-lifecycle]

Models are deterministic values and expose results directly without global events.

All subscriptions and registrations return a disposer or belong to an owning
runtime that disposes them in reverse order.

## Example [#example]

```tsx
import { StructuredContentModel } from "@mwillbanks/tuil-content";

const model = new StructuredContentModel({ service: { ready: true } });
```

## Related [#related]

* [Package architecture](/tuil/docs/concepts/packages)
* [Events](/tuil/docs/concepts/events)
* [Testing](/tuil/docs/guides/testing)
