> ## Documentation Index
> Fetch the complete documentation index at: https://docs.runpulse.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Elements and bounding boxes

> Read a parse's elements, place their boxes on the page, and link Markdown and citations back to them.

A [parse](https://docs.runpulse.com/v2/parse.md) result describes the document twice: as `markdown`, and as `elements`, the document's pieces in reading order, each with what it is, its content and where it sits on its page. Use elements to show where something came from, for example to highlight a value on the page.

## What an element holds

This is one element:

```json theme={null}
{
  "id": "Title-0",
  "category": "Title",
  "content": "Statement of Account",
  "confidence": 0.99,
  "page": 1,
  "bbox": [0.2196, 0.1225, 0.4578, 0.1348, 0.4557, 0.1537, 0.2174, 0.1417]
}
```

| Field | What it holds |
| - | - |
| `id` | The element's category and its place among all the elements in reading order, counting from 0: `Title-0` is the first element, `Text-12` the thirteenth. |
| `category` | What the element is: `Title`, `Section-header`, `Text`, `List-item`, `Table`, `Figure`, `Caption`, `Footnote`, `Formula`, `Page-header`, `Page-footer` or `Page-number`. |
| `content` | The element's text. A table's `content` is the table as HTML, and a figure has none. |
| `confidence` | How sure Pulse is of the element, from 0 to 1, or `null` when there's no score, as on spreadsheets and figure captions. |
| `page` | The element's page, counting from 1. With a `page_range` of `5-7`, the document's page 5 is page 1. |
| `bbox` | The element's outline on its page. See [Bounding boxes](#bounding-boxes). |

A `Figure`'s caption is a separate `Caption` element. Two more categories appear outside the `elements` list: `Cell`, for table cells, and `Word`, for [word boxes](#word-boxes).

### Tables and cells

A `Table` element has `dimensions`, its number of `rows` and `columns`, and `cells`, listed row by row. Each cell has its own `content`, `page` and `bbox`, a `row` and a `column`, counting from 0, and a `row_span` or `column_span` when it covers more than one. A cell's `id` adds its row and column to its table's, as in `Table-3-r0c2`.

***

## Bounding boxes

An element's `bbox` lists its four corners as eight numbers, `[x1, y1, …, x4, y4]`, clockwise from the top-left. Each `x` is a fraction of the page's width, and each `y` a fraction of its height, measured from the page's top-left corner. Every value is between 0 and 1.

To draw a box on a page image, multiply each `x` by the image's width and each `y` by its height:

```python theme={null}
def to_pixels(bbox, width, height):
    return [round(v * (width if i % 2 == 0 else height)) for i, v in enumerate(bbox)]
```

The four corners are a polygon, so they needn't form a level rectangle. For a level box, take the smallest and largest `x` and `y`.

`bbox` is `null` on some picture captions, and on every spreadsheet element, which names its `sheet` and its cells' `range` instead, such as `B2:D2`.

## Word boxes

With `"word_level_bounding_boxes": true` in `config.extensions`, the result lists every word as a `Word` element, with its `bbox`, in `extensions.word_level_bounding_boxes`. Your organization must have word boxes enabled; to enable them, contact [support](https://docs.runpulse.com/v2/support.md).

These dashboard screenshots show element boxes, then word boxes, on the same bank statement:

![Bank statement with a box around each block and table](https://mintcdn.com/pulseai/OJ897TEZf8bV6lk8/images/platform/bounding-box-output.png?fit=max\&auto=format\&n=OJ897TEZf8bV6lk8\&q=85\&s=0b562133d347513283ce08e2caeb3ca2)

Element boxes (the default): one per text block or table.

![The same statement with a box around every word](https://mintcdn.com/pulseai/OJ897TEZf8bV6lk8/images/platform/word-level-bbox-output.png?fit=max\&auto=format\&n=OJ897TEZf8bV6lk8\&q=85\&s=a32a03a841e594c3ecf34a829d1efb4b)

Word boxes: one per word.

***

## Link Markdown and citations to elements

To find an element in the Markdown, ask for `tagged_md` in `config.extensions.additional_formats`. The result's `extensions.additional_formats.tagged_md` is the Markdown with each element's `id` in a `data-element-id` attribute. Tables, cells and figures carry the attribute on their own tags, and each text block is wrapped in a `<div>` that carries it:

```html theme={null}
<div data-element-id="Title-0">

# Statement of Account

</div>
```

Apart from the attributes and the `<div>` wrappers, the text is the same as `markdown`. An element that Pulse can't find in the Markdown is left untagged.

[Extract](https://docs.runpulse.com/v2/extract.md)'s citations use the same ids: each value in `extraction.enriched` carries a `citation` list of the elements it came from:

```json theme={null}
{
  "value": "Statement of Account",
  "citation": [{ "element_id": "Title-0" }],
  "confidence": 0.98
}
```

The [highlight sources](https://docs.runpulse.com/v2/cookbooks/highlight-sources.md) cookbook draws a value's box on its page.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.