# garden.lexicon.rational-mastodon.html2

> Published by [chrisshank.com](https://lexicon.garden/identity/did:plc:zcanytzlaumjwgaopolw6wes)

✓ This is the authoritative definition for this NSID.

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:zcanytzlaumjwgaopolw6wes/garden.lexicon.rational-mastodon.html2)
- [Documentation](https://lexicon.garden/lexicon/did:plc:zcanytzlaumjwgaopolw6wes/garden.lexicon.rational-mastodon.html2/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:zcanytzlaumjwgaopolw6wes/garden.lexicon.rational-mastodon.html2/examples)

## Definitions

### `garden.lexicon.rational-mastodon.html2`

**Type**: `record`

Root of the HTML document or fragment.

**Key**: `tid`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `children` | `array` | Yes |  |

### `garden.lexicon.rational-mastodon.html2#text`

**Type**: `object`

An HTML text node (https://developer.mozilla.org/en-US/docs/Web/API/Text)

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `value` | `string` | Yes |  |

### `garden.lexicon.rational-mastodon.html2#comment`

**Type**: `object`

An HTML comment node (https://developer.mozilla.org/en-US/docs/Web/HTML/Guides/Comments)

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `value` | `string` | Yes |  |

### `garden.lexicon.rational-mastodon.html2#docType`

**Type**: `object`

An HTML Doctype node (https://developer.mozilla.org/en-US/docs/Glossary/Doctype)

| Property | Type | Required | Description |
|----------|------|----------|-------------|

### `garden.lexicon.rational-mastodon.html2#element`

**Type**: `object`

An HTML element node (https://developer.mozilla.org/en-US/docs/Web/API/Element)

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `tagName` | `string` | Yes |  |
| `children` | `array` | Yes |  |
| `attributes` | `array` | Yes |  |

### `garden.lexicon.rational-mastodon.html2#attribute`

**Type**: `object`

An HTML attribute (https://developer.mozilla.org/en-US/docs/Glossary/Attribute)

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `name` | `string` | Yes |  |
| `value` | `string` | Yes |  |

## Examples

The following examples demonstrate valid data for this lexicon. [View all examples](https://lexicon.garden/lexicon/did:plc:zcanytzlaumjwgaopolw6wes/garden.lexicon.rational-mastodon.html2/examples)

### Example 1 (`#main`)

**Description**: Hello World

```json
{
  "$type": "garden.lexicon.rational-mastodon.html2",
  "children": [
    {
      "$type": "garden.lexicon.rational-mastodon.html2#element",
      "tagName": "h1",
      "children": [
        {
          "$type": "garden.lexicon.rational-mastodon.html2#text",
          "value": "Hello World"
        }
      ],
      "attributes": []
    }
  ]
}
```

### Example 2 (`#main`)

**Description**: Empty Document

```json
{
  "$type": "garden.lexicon.rational-mastodon.html2",
  "children": []
}
```

## Raw Schema

```json
{
  "id": "garden.lexicon.rational-mastodon.html2",
  "defs": {
    "main": {
      "key": "tid",
      "type": "record",
      "record": {
        "type": "object",
        "required": [
          "children"
        ],
        "properties": {
          "children": {
            "type": "array",
            "items": {
              "refs": [
                "#docType",
                "#element",
                "#text",
                "#comment"
              ],
              "type": "union"
            }
          }
        }
      },
      "description": "Root of the HTML document or fragment."
    },
    "text": {
      "type": "object",
      "required": [
        "value"
      ],
      "properties": {
        "value": {
          "type": "string"
        }
      },
      "description": "An HTML text node (https://developer.mozilla.org/en-US/docs/Web/API/Text)"
    },
    "comment": {
      "type": "object",
      "required": [
        "value"
      ],
      "properties": {
        "value": {
          "type": "string"
        }
      },
      "description": "An HTML comment node (https://developer.mozilla.org/en-US/docs/Web/HTML/Guides/Comments)"
    },
    "docType": {
      "type": "object",
      "properties": {},
      "description": "An HTML Doctype node (https://developer.mozilla.org/en-US/docs/Glossary/Doctype)"
    },
    "element": {
      "type": "object",
      "required": [
        "tagName",
        "attributes",
        "children"
      ],
      "properties": {
        "tagName": {
          "type": "string"
        },
        "children": {
          "type": "array",
          "items": {
            "refs": [
              "#element",
              "#text",
              "#comment"
            ],
            "type": "union"
          }
        },
        "attributes": {
          "type": "array",
          "items": {
            "ref": "#attribute",
            "type": "ref"
          }
        }
      },
      "description": "An HTML element node (https://developer.mozilla.org/en-US/docs/Web/API/Element)"
    },
    "attribute": {
      "type": "object",
      "required": [
        "name",
        "value"
      ],
      "properties": {
        "name": {
          "type": "string"
        },
        "value": {
          "type": "string"
        }
      },
      "description": "An HTML attribute (https://developer.mozilla.org/en-US/docs/Glossary/Attribute)"
    }
  },
  "lexicon": 1
}
```
