# Wasot Syntax Integration Tests

This file contains integration tests for the Wasot parser. Each test verifies that a given Wasot input produces the expected sequence of events.

## Test Format

- Test names are defined as `**test name**`
- Description follows the test name
- Input is provided in a ```wasot code block
- Expected events are defined in a ```yaml block

---

**Simple paragraph**

Test a basic single-level block with text content.

```wasot
.paragraph
This is a simple paragraph.
```

```yaml
- block-started:
    type: paragraph
    level: 1
- text-finished:
    lines: ["This is a simple paragraph."]
- block-finished
```

---

**Empty block**

Test a block with no text content.

```wasot
.empty
```

```yaml
- block-started:
    type: empty
    level: 1
- block-finished
```

---

**Block with inline text**

Test a block that has inline text defined on the meta line.

```wasot
.heading This is the heading text
Some body content here.
```

```yaml
- block-started:
    type: heading
    level: 1
    inline-text: "This is the heading text"
- text-finished:
    lines: ["Some body content here."]
- block-finished
```

---

**Block with arguments**

Test a block with positional arguments and keyword arguments.

```wasot
.div .. theme="primary" section="main"
Content inside the div.
```

```yaml
- block-started:
    type: div
    level: 1
    kwargs:
      theme: "primary"
      section: "main"
- text-finished:
    lines: ["Content inside the div."]
- block-finished
```

---

**Block with ID**

Test a block with an ID specified using the colon syntax.

```wasot
.section :intro-section
Welcome to our documentation.
```

```yaml
- block-started:
    type: section
    level: 1
    id: "intro-section"
- text-finished:
    lines: ["Welcome to our documentation."]
- block-finished
```

---

**Nested blocks**

Test multiple levels of nested blocks.

```wasot
.outer
Outer block text.
..inner
Inner block text.
...deeply-nested
Very deep text.
```

```yaml
- block-started:
    type: outer
    level: 1
- text-finished:
    lines: ["Outer block text."]
- block-started:
    type: inner
    level: 2
- text-finished:
    lines: ["Inner block text."]
- block-started:
    type: deeply-nested
    level: 3
- text-finished:
    lines: ["Very deep text."]
- block-finished
- block-finished
- block-finished
```

---

**Quoted block type**

Test a block type that contains spaces and requires quotes.

```wasot
."code block" language="python"
print("Hello, World!")
```

```yaml
- block-started:
    type: "code block"
    level: 1
    inline-text: "language=\"python\""
- text-finished:
    lines: ["print(\"Hello, World!\")"]
- block-finished
```

---

**Mixed arguments**

Test a block with both positional and keyword arguments.

```wasot
.button primary large .. disabled=true title="Click me"
Submit
```

```yaml
- block-started:
    type: button
    level: 1
    inline-text: "primary large "
    kwargs:
      disabled: "true"
      title: "Click me"
- text-finished:
    lines: ["Submit"]
- block-finished
```

---

**Self-closing block**

Test a self-closing block using the .# syntax.

```wasot
.# Page Title
```

```yaml
- block-started:
    type: "#"
    level: 1
    inline-text: "Page Title"
- block-finished
```

---

**Complex inline and parameters**

Test a block with inline text, ID, and parameters all together.

```wasot
.alert Warning message .. type="danger" dismissible=true :alert-1
This is an important alert that can be dismissed.
```

```yaml
- block-started:
    type: alert
    level: 1
    id: "alert-1"
    inline-text: "Warning message "
    kwargs:
      type: "danger"
      dismissible: "true"
- text-finished:
    lines: ["This is an important alert that can be dismissed."]
- block-finished
```

---

**Block type with numbers**

Test block types that contain numbers.

```wasot
.h1
.block123
```

```yaml
- block-started:
    type: h1
    level: 1
- block-finished
- block-started:
    type: block123
    level: 1
- block-finished
```

---

**Block type with special characters**

Test block types containing dashes and underscores.

```wasot
.type-name
Content for type-name.
.type_name
Content for type_name.
```

```yaml
- block-started:
    type: "type-name"
    level: 1
- text-finished:
    lines: ["Content for type-name."]
- block-finished
- block-started:
    type: type_name
    level: 1
- text-finished:
    lines: ["Content for type_name."]
- block-finished
```

---

**Quoted block type with spaces**

Test quoted block types that contain spaces.

```wasot
."my block type"
Content for custom block type.
```

```yaml
- block-started:
    type: "my block type"
    level: 1
- text-finished:
    lines: ["Content for custom block type."]
- block-finished
```

---

**Heading blocks with hash**

Test special heading syntax using # characters.

```wasot
.##
.### Deep Section
```

```yaml
- block-started:
    type: "##"
    level: 1
- block-finished
- block-started:
    type: "###"
    level: 1
    inline-text: "Deep Section"
- block-finished
```

---

**Just a dot block**

Test a single dot with no type creates an empty-type block.

```wasot
.
Content here.
```

```yaml
- block-started:
    type: ""
    level: 1
- block-finished
- text-finished:
    lines: ["Content here."]
```

---

**Empty parameters**

Test blocks with empty parameter sections.

```wasot
.div text ..
Some content.
```

```yaml
- block-started:
    type: div
    level: 1
    inline-text: "text "
- text-finished:
    lines: ["Some content."]
- block-finished
```

---

**Multiple positional arguments**

Test blocks with multiple positional arguments.

```wasot
.button .. primary large rounded
Click me!
```

```yaml
- block-started:
    type: button
    level: 1
    args: ["primary", "large", "rounded"]
- text-finished:
    lines: ["Click me!"]
- block-finished
```

---

**Simple keyword arguments**

Test blocks with basic keyword arguments.

```wasot
.div .. class="container" id="main"
Content with kwargs.
```

```yaml
- block-started:
    type: div
    level: 1
    kwargs:
      class: container
      id: main
- text-finished:
    lines: ["Content with kwargs."]
- block-finished
```

---

**Quoted keys and values**

Test keyword arguments with quoted keys and values.

```wasot
.component .. "my key"="my value" style="color: red;"
Component content.
```

```yaml
- block-started:
    type: component
    level: 1
    kwargs:
      "my key": "my value"
      style: "color: red;"
- text-finished:
    lines: ["Component content."]
- block-finished
```

---

**Mixed arguments order**

Test mixing positional and keyword arguments.

```wasot
.widget .. primary enabled class="btn" onclick="click()"
Widget content.
```

```yaml
- block-started:
    type: widget
    level: 1
    args: ["primary", "enabled"]
    kwargs:
      class: btn
      onclick: click()
- text-finished:
    lines: ["Widget content."]
- block-finished
```

---

**ID with colons for namespacing**

Test IDs that contain colons for namespacing.

```wasot
.div :page:header:logo
Logo content here.
```

```yaml
- block-started:
    type: div
    level: 1
    id: "page:header:logo"
- text-finished:
    lines: ["Logo content here."]
- block-finished
```

---

**ID with special characters**

Test IDs with various special characters.

```wasot
.span :item-123_abc
.div :test:namespace:id
```

```yaml
- block-started:
    type: span
    level: 1
    id: "item-123_abc"
- block-finished
- block-started:
    type: div
    level: 1
    id: "test:namespace:id"
- block-finished
```

---

**Block type starting with number**

Test block types that start with numbers.

```wasot
.123class
Content for numbered type.
```

```yaml
- block-started:
    type: 123class
    level: 1
- text-finished:
    lines: ["Content for numbered type."]
- block-finished
```

---

**Escaped quotes in block type**

Test quoted block types with escaped quotes inside.

```wasot
."type \"quoted\""
Content for escaped quotes.
```

```yaml
- block-started:
    type: "type \"quoted\""
    level: 1
- text-finished:
    lines: ["Content for escaped quotes."]
- block-finished
```

---

**Unicode block type**

Test block types with Unicode characters.

```wasot
.日本語
Japanese content.
.café
French content.
```

```yaml
- block-started:
    type: 日本語
    level: 1
- text-finished:
    lines: ["Japanese content."]
- block-finished
- block-started:
    type: café
    level: 1
- text-finished:
    lines: ["French content."]
- block-finished
```

---

**Unclosed quoted block type**

Test handling of unclosed quotes in block types.

```wasot
."unclosed
Some content.
```

```yaml
- block-started:
    type: "\"unclosed"
    level: 1
- text-finished:
    lines: ["Some content."]
- block-finished
```

---

**ID with inline text**

Test IDs combined with inline text.

```wasot
.div Hello World :my-id
Content here.
```

```yaml
- block-started:
    type: div
    level: 1
    id: "my-id"
    inline-text: "Hello World"
- text-finished:
    lines: ["Content here."]
- block-finished
```

---

**ID with parameters**

Test IDs combined with parameters.

```wasot
.div .. class="container" :main-div
Div content.
```

```yaml
- block-started:
    type: div
    level: 1
    metaline-quoted: false
    id: "main-div"
    kwargs:
      class: container
- text-finished:
    lines: ["Div content."]
- block-finished
```

---

**Everything combined**

Test all meta-line features together.

```wasot
."custom block" "Inline text" .. arg1 "arg 2" key="value" :my-id
Content with everything.
```

```yaml
- block-started:
    type: "custom block"
    level: 1
    id: "my-id"
    inline-text: "Inline text"
    args: ["arg1", "arg 2"]
    kwargs:
      key: value
- text-finished:
    lines: ["Content with everything."]
- block-finished
```

---

**Multiple separators**

Test multiple .. separators in parameters.

```wasot
.block .. param1 .. param2 .. param3
Block content.
```

```yaml
- block-started:
    type: block
    level: 1
    args: ["param1", "..", "param2", "..", "param3"]
- text-finished:
    lines: ["Block content."]
- block-finished
```

---

**Empty quoted arguments**

Test empty quoted arguments and values.

```wasot
.component .. "" key=""
Component content.
```

```yaml
- block-started:
    type: component
    level: 1
    args: [""]
    kwargs:
      key: ""
- text-finished:
    lines: ["Component content."]
- block-finished
```

---

**Arguments with special characters**

Test arguments containing special characters.

```wasot
.special .. @notify #hashtag url="https://example.com?foo=bar&baz=qux"
Special content.
```

```yaml
- block-started:
    type: special
    level: 1
    args: ["@notify", "#hashtag"]
    kwargs:
      url: "https://example.com?foo=bar&baz=qux"
- text-finished:
    lines: ["Special content."]
- block-finished
```

---

**Unicode in arguments**

Test Unicode characters in argument keys and values.

```wasot
.widget .. キー=値 language="日本語"
Unicode content.
```

```yaml
- block-started:
    type: widget
    level: 1
    kwargs:
      キー: 値
      language: 日本語
- text-finished:
    lines: ["Unicode content."]
- block-finished
```

---

**Multiple equals in value**

Test values that contain equals signs.

```wasot
.equation .. formula="x=y+z" expression="a=b=c"
Math content.
```

```yaml
- block-started:
    type: equation
    level: 1
    kwargs:
      formula: x=y+z
      expression: a=b=c
- text-finished:
    lines: ["Math content."]
- block-finished
```

---

**Interspersed arguments**

Test positional and keyword arguments mixed together.

```wasot
.mixed .. arg1 key1=val1 arg2 key2=val2 arg3
Mixed content.
```

```yaml
- block-started:
    type: mixed
    level: 1
    args: ["arg1", "arg2", "arg3"]
    kwargs:
      key1: val1
      key2: val2
- text-finished:
    lines: ["Mixed content."]
- block-finished
```

---

**Complex quoted arguments**

Test complex quoting in mixed arguments.

```wasot
.complex .. "arg 1" key="val 1" "key 2"="val 2"
Complex content.
```

```yaml
- block-started:
    type: complex
    level: 1
    args: ["arg 1"]
    kwargs:
      key: "val 1"
      "key 2": "val 2"
- text-finished:
    lines: ["Complex content."]
- block-finished
```

---

**Simple URL link**

Test basic URL links in text content.

```wasot
.paragraph
Check out ((https://wasot.org)) for more info.
```

```yaml
- block-started:
    type: paragraph
    level: 1
- text-finished:
    lines: ["Check out ((https://wasot.org)) for more info."]
    links:
      - line: 0
        links:
            name: "https://wasot.org"
            start: 10
            length: 21
- block-finished
```

---

**Named link**

Test links with display names.

```wasot
.paragraph
Visit ((Wasot Documentation|https://docs.wasot.org)) for details.
```

```yaml
- block-started:
    type: paragraph
    level: 1
- text-finished:
    lines: ["Visit ((Wasot Documentation|https://docs.wasot.org)) for details."]
    links:
      - line: 0
        links:
            name: "Wasot Documentation|https://docs.wasot.org"
            start: 6
            length: 46
- block-finished
```

---

**ID reference link**

Test links to other blocks by ID.

```wasot
.paragraph
See the ((:introduction)) section below.
```

```yaml
- block-started:
    type: paragraph
    level: 1
- text-finished:
    lines: ["See the ((:introduction)) section below."]
    links:
      - line: 0
        links:
          - target: introduction
            start: 8
            length: 17
- block-finished
```

---

**Multiple links in line**

Test multiple links appearing in one line.

```wasot
.paragraph
Check ((https://wasot.org)) and ((https://github.com/wasot)) for more.
```

```yaml
- block-started:
    type: paragraph
    level: 1
- text-finished:
    lines: ["Check ((https://wasot.org)) and ((https://github.com/wasot)) for more."]
    links:
      - line: 0
        links:
            name: "https://wasot.org"
            start: 6
            length: 21
            name: "https://github.com/wasot"
            start: 32
            length: 28
- block-finished
```

---

**Emoji block type**

Test block types with complex Unicode including emojis.

```wasot
.émojis👨‍👩‍👧‍👦
Content with emoji block type.
```

```yaml
- block-started:
    type: émojis👨‍👩‍👧‍👦
    level: 1
- text-finished:
    lines: ["Content with emoji block type."]
- block-finished
```

---

**Empty ID**

Test blocks with empty ID syntax.

```wasot
.div :
Content with empty ID.
```

```yaml
- block-started:
    type: div
    level: 1
    inline-text: ":"
- text-finished:
    lines: ["Content with empty ID."]
- block-finished
```

---

**Unicode ID**

Test IDs with Unicode characters.

```wasot
.div :日本語id
Content with Unicode ID.
```

```yaml
- block-started:
    type: div
    level: 1
    id: 日本語id
- text-finished:
    lines: ["Content with Unicode ID."]
- block-finished
```

---

**Basic combinations type and inline**

Test basic combination of type and inline text.

```wasot
.div Hello World
```

```yaml
- block-started:
    type: div
    level: 1
    inline-text: "Hello World"
- block-finished
```

---

**Basic combinations type and params**

Test basic combination of type and parameters.

```wasot
.div .. class="container"
```

```yaml
- block-started:
    type: div
    level: 1
    kwargs:
      class: container
- block-finished
```

---

**Basic combinations type and ID**

Test basic combination of type and ID.

```wasot
.div :my-id
```

```yaml
- block-started:
    type: div
    level: 1
    id: "my-id"
- block-finished
```

---

**Empty quoted argument value**

Test keyword arguments with empty values.

```wasot
.widget .. key=""
Widget content.
```

```yaml
- block-started:
    type: widget
    level: 1
    kwargs:
      key: ""
- text-finished:
    lines: ["Widget content."]
- block-finished
```

---

**Arguments with equals but no value**

Test positional arguments that end with equals.

```wasot
.form .. submit=
Form content.
```

```yaml
- block-started:
    type: form
    level: 1
    kwargs:
      submit: ""
- text-finished:
    lines: ["Form content."]
- block-finished
```

---

**Multi-line text content**

Test blocks with multiple lines of text.

```wasot
.story
Once upon a time,
in a land far away,
there lived a parser.
```

```yaml
- block-started:
    type: story
    level: 1
- text-finished:
    lines:
      - "Once upon a time,"
      - "in a land far away,"
      - "there lived a parser."
- block-finished
```

---

**Advanced links with arguments**

Test links that contain arguments.

```wasot
.paragraph
Click ((submit .. class="btn" type="primary")) to continue.
```

```yaml
- block-started:
    type: paragraph
    level: 1
- text-finished:
    lines: ["Click ((submit .. class=\"btn\" type=\"primary\")) to continue."]
    links:
      - line: 0
        links:
            name: submit
            start: 6
            length: 40
- block-finished
```

---

**Simple block types**

Test basic block types like div, p, span.

```wasot
.div
.p
.span
```

```yaml
- block-started:
    type: div
    level: 1
- block-finished
- block-started:
    type: p
    level: 1
- block-finished
- block-started:
    type: span
    level: 1
- block-finished
```

---

**Heading blocks**

Test special heading syntax using hash characters.

```wasot
.#
.##
.###
```

```yaml
- block-started:
    type: "#"
    level: 1
- block-finished
- block-started:
    type: "##"
    level: 1
- block-finished
- block-started:
    type: "###"
    level: 1
- block-finished
```

---

**Empty type blocks**

Test blocks with empty types using just dots.

```wasot
.
..
```

```yaml
- block-started:
    type: ""
    level: 1
- block-finished
- block-started:
    type: ""
    level: 2
- block-finished
```

---

**Empty parameter section**

Test blocks with empty parameter sections after separator.

```wasot
.div text ..
```

```yaml
- block-started:
    type: div
    level: 1
    inline-text: "text "
- block-finished
```

---

**Multiple parameter separators**

Test multiple .. separators in parameters.

```wasot
.div text .. p1 .. p2
```

```yaml
- block-started:
    type: div
    level: 1
    inline-text: "text "
    args: ["p1", "..", "p2"]
- block-finished
```

---

**Mixed dots in parameters**

Test parameter parsing with multiple dots.

```wasot
.div .. .. .. .. text
```

```yaml
- block-started:
    type: div
    level: 1
    args: ["..", "..", "..", "text"]
- block-finished
```

---

**Single positional argument**

Test blocks with a single positional argument.

```wasot
.button .. primary
Button text.
```

```yaml
- block-started:
    type: button
    level: 1
    args: ["primary"]
- text-finished:
    lines: ["Button text."]
- block-finished
```

---

**Three positional arguments**

Test blocks with multiple positional arguments.

```wasot
.button .. primary large rounded
Click me!
```

```yaml
- block-started:
    type: button
    level: 1
    args: ["primary", "large", "rounded"]
- text-finished:
    lines: ["Click me!"]
- block-finished
```

---

**Special character arguments**

Test arguments containing various special characters.

```wasot
.component .. @#$%^&*()
Component content.
```

```yaml
- block-started:
    type: component
    level: 1
    args: ["@#$%^&*()"]
- text-finished:
    lines: ["Component content."]
- block-finished
```

---

**Simple keyword argument**

Test basic keyword argument syntax.

```wasot
.element .. key=value
Element content.
```

```yaml
- block-started:
    type: element
    level: 1
    kwargs:
      key: value
- text-finished:
    lines: ["Element content."]
- block-finished
```

---

**Quoted key in kwargs**

Test keyword arguments with quoted keys.

```wasot
.element .. "my key"=value
Element content.
```

```yaml
- block-started:
    type: element
    level: 1
    kwargs:
      "my key": value
- text-finished:
    lines: ["Element content."]
- block-finished
```

---

**Quoted value in kwargs**

Test keyword arguments with quoted values.

```wasot
.element .. key="my value"
Element content.
```

```yaml
- block-started:
    type: element
    level: 1
    kwargs:
      key: "my value"
- text-finished:
    lines: ["Element content."]
- block-finished
```

---

**Both quoted in kwargs**

Test keyword arguments with both key and value quoted.

```wasot
.element .. "my key"="my value"
Element content.
```

```yaml
- block-started:
    type: element
    level: 1
    kwargs:
      "my key": "my value"
- text-finished:
    lines: ["Element content."]
- block-finished
```

---

**Special chars in kwarg value**

Test keyword values with special characters.

```wasot
.element .. key=@#$%^&*()
Element content.
```

```yaml
- block-started:
    type: element
    level: 1
    kwargs:
      key: "@#$%^&*()"
- text-finished:
    lines: ["Element content."]
- block-finished
```

---

**Multiple equals in kwarg value**

Test keyword values that contain equals signs.

```wasot
.element .. key=val=ue
Element content.
```

```yaml
- block-started:
    type: element
    level: 1
    kwargs:
      key: val=ue
- text-finished:
    lines: ["Element content."]
- block-finished
```

---

**Unicode in kwargs**

Test Unicode characters in keyword arguments.

```wasot
.element .. キー=値
Element content.
```

```yaml
- block-started:
    type: element
    level: 1
    kwargs:
      キー: 値
- text-finished:
    lines: ["Element content."]
- block-finished
```

---

**Namespaced ID with document prefix**

Test IDs that use colon-separated namespacing with document prefix style.

```wasot
.div :docid:id
Content here.
```

```yaml
- block-started:
    type: div
    level: 1
    id: "docid:id"
- text-finished:
    lines: ["Content here."]
- block-finished
```

---

**ID with numbers**

Test IDs that contain numbers.

```wasot
.div :id123
Content here.
```

```yaml
- block-started:
    type: div
    level: 1
    id: id123
- text-finished:
    lines: ["Content here."]
- block-finished
```

---

**ID with dashes and underscores**

Test IDs with dashes and underscores.

```wasot
.div :my-id_123
Content here.
```

```yaml
- block-started:
    type: div
    level: 1
    id: "my-id_123"
- text-finished:
    lines: ["Content here."]
- block-finished
```

---

**ID starting with number**

Test IDs that start with numbers.

```wasot
.div :123id
Content here.
```

```yaml
- block-started:
    type: div
    level: 1
    id: 123id
- text-finished:
    lines: ["Content here."]
- block-finished
```

---

**Multiple colons in ID**

Test IDs with multiple colons for namespacing.

```wasot
.div :namespace:id
Content here.
```

```yaml
- block-started:
    type: div
    level: 1
    id: "namespace:id"
- text-finished:
    lines: ["Content here."]
- block-finished
```

---

**Empty ID syntax**

Test blocks with empty ID syntax.

```wasot
.div :
Content here.
```

```yaml
- block-started:
    type: div
    level: 1
    inline-text: ":"
- text-finished:
    lines: ["Content here."]
- block-finished
```

---

**Unicode ID characters**

Test IDs with Unicode characters.

```wasot
.div :日本語id
Content here.
```

```yaml
- block-started:
    type: div
    level: 1
    id: 日本語id
- text-finished:
    lines: ["Content here."]
- block-finished
```

---

**Type only combination**

Test basic type-only blocks.

```wasot
.div
```

```yaml
- block-started:
    type: div
    level: 1
- block-finished
```

---

**Type and inline combination**

Test basic combination of type and inline text.

```wasot
.div text
```

```yaml
- block-started:
    type: div
    level: 1
    inline-text: "text"
- block-finished
```

---

**Type and params combination**

Test basic combination of type and parameters.

```wasot
.div .. params
```

```yaml
- block-started:
    type: div
    level: 1
    args: ["params"]
- block-finished
```

---

**Type and ID combination**

Test basic combination of type and ID.

```wasot
.div :id
```

```yaml
- block-started:
    type: div
    level: 1
    id: id
- block-finished
```

---

**Single line text content**

Test blocks with single line text content.

```wasot
.paragraph
This is a single line of text.
```

```yaml
- block-started:
    type: paragraph
    level: 1
- text-finished:
    lines: ["This is a single line of text."]
- block-finished
```

---

**Multiple line text content**

Test blocks with multiple lines of text content.

```wasot
.paragraph
First line of text.
Second line of text.
Third line of text.
```

```yaml
- block-started:
    type: paragraph
    level: 1
- text-finished:
    lines:
      - "First line of text."
      - "Second line of text."
      - "Third line of text."
- block-finished
```

---

**Empty text content block**

Test blocks with no text content.

```wasot
.paragraph
```

```yaml
- block-started:
    type: paragraph
    level: 1
- block-finished
```

---

**ID with inline text placement**

Test IDs combined with inline text.

```wasot
.div text :id
Content here.
```

```yaml
- block-started:
    type: div
    level: 1
    id: id
    inline-text: "text"
- text-finished:
    lines: ["Content here."]
- block-finished
```

---

**ID with params placement**

Test IDs combined with parameters.

```wasot
.div .. params :id
Content here.
```

```yaml
- block-started:
    type: div
    level: 1
    id: id
    args: ["params"]
- text-finished:
    lines: ["Content here."]
- block-finished
```

---

**ID with everything**

Test IDs with inline text and parameters.

```wasot
.div text .. params :id
Content here.
```

```yaml
- block-started:
    type: div
    level: 1
    id: id
    inline-text: "text "
    args: ["params"]
- text-finished:
    lines: ["Content here."]
- block-finished
```

---

**Text with leading whitespace**

Test text content with leading and trailing whitespace.

```wasot
.paragraph
   Text with leading spaces   
```

```yaml
- block-started:
    type: paragraph
    level: 1
- text-finished:
    lines: ["   Text with leading spaces   "]
- block-finished
```

---

**Very long text line**

Test handling of very long text lines.

```wasot
.paragraph
This is a very long line of text that contains many words and characters to test the parser's ability to handle long content without issues or memory problems when processing large amounts of text data in a single line.
```

```yaml
- block-started:
    type: paragraph
    level: 1
- text-finished:
    lines: ["This is a very long line of text that contains many words and characters to test the parser's ability to handle long content without issues or memory problems when processing large amounts of text data in a single line."]
- block-finished
```

---

**Block with no children**

Test blocks that have no child content.

```wasot
.container
```

```yaml
- block-started:
    type: container
    level: 1
- block-finished
```

---

**Block with text children only**

Test blocks containing only text content.

```wasot
.article
This is the first paragraph.
This is the second paragraph.
This is the third paragraph.
```

```yaml
- block-started:
    type: article
    level: 1
- text-finished:
    lines:
      - "This is the first paragraph."
      - "This is the second paragraph."
      - "This is the third paragraph."
- block-finished
```

---

**Block with block children only**

Test blocks containing only nested blocks.

```wasot
.container
..section
..article
..footer
```

```yaml
- block-started:
    type: container
    level: 1
- block-started:
    type: section
    level: 2
- block-finished
- block-started:
    type: article
    level: 2
- block-finished
- block-started:
    type: footer
    level: 2
- block-finished
- block-finished
```

---

**Block with mixed children**

Test blocks with both text and nested block content.

```wasot
.article
Introduction text here.
..section
Section content.
More article text.
```

```yaml
- block-started:
    type: article
    level: 1
- text-finished:
    lines: ["Introduction text here."]
- block-started:
    type: section
    level: 2
- text-finished:
    lines:
      - "Section content."
      - "More article text."
- block-finished
- block-finished
```

---

**Adjacent text lines**

Test multiple adjacent text lines that get merged.

```wasot
.paragraph
First line.
Second line.
Third line.

Fourth line after gap.
```

```yaml
- block-started:
    type: paragraph
    level: 1
- text-finished:
    lines:
      - "First line."
      - "Second line."
      - "Third line."
      - ""
      - "Fourth line after gap."
- block-finished
```

---

**Space separated tokenization**

Test basic space-separated token parsing.

```wasot
.div .. arg1 arg2 arg3
Content here.
```

```yaml
- block-started:
    type: div
    level: 1
    args: ["arg1", "arg2", "arg3"]
- text-finished:
    lines: ["Content here."]
- block-finished
```

---

**Quoted tokens with spaces**

Test tokenization of quoted strings containing spaces.

```wasot
.div .. "arg with spaces" "another arg"
Content here.
```

```yaml
- block-started:
    type: div
    level: 1
    args: ["arg with spaces", "another arg"]
- text-finished:
    lines: ["Content here."]
- block-finished
```

---

**Empty tokens between spaces**

Test handling of multiple consecutive spaces creating empty tokens.

```wasot
.div .. arg1    arg2
Content here.
```

```yaml
- block-started:
    type: div
    level: 1
    args: ["arg1", "arg2"]
- text-finished:
    lines: ["Content here."]
- block-finished
```

---

**Tokens with equals signs**

Test tokenization when arguments contain equals signs.

```wasot
.div .. arg1=value arg2
Content here.
```

```yaml
- block-started:
    type: div
    level: 1
    args: ["arg2"]
    kwargs:
      arg1: value
- text-finished:
    lines: ["Content here."]
- block-finished
```

---

**Mixed quoted and unquoted tokens**

Test mixing quoted and unquoted tokens in parameters.

```wasot
.div .. unquoted "quoted arg" another
Content here.
```

```yaml
- block-started:
    type: div
    level: 1
    args: ["unquoted", "quoted arg", "another"]
- text-finished:
    lines: ["Content here."]
- block-finished
```

---

**Nested quotes handling**

Test handling of quotes within quoted strings.

```wasot
.div .. "outer \"inner\" outer"
Content here.
```

```yaml
- block-started:
    type: div
    level: 1
    args: ["outer \"inner\" outer"]
- text-finished:
    lines: ["Content here."]
- block-finished
```

---

**Quote preservation in output**

Test that quotes are properly preserved in tokenized output.

```wasot
.div .. key="\"quoted value\""
Content here.
```

```yaml
- block-started:
    type: div
    level: 1
    kwargs:
      key: "\"quoted value\""
- text-finished:
    lines: ["Content here."]
- block-finished
```

---

**Escaped quotes in arguments**

Test handling of escaped quotes in argument parsing.

```wasot
.div .. arg=\"value\"
Content here.
```

```yaml
- block-started:
    type: div
    level: 1
    kwargs:
      arg: "\\value\\"
- text-finished:
    lines: ["Content here."]
- block-finished
```

---

**Unclosed quotes fallback**

Test parser behavior with unclosed quotes.

```wasot
.div .. "unclosed quote arg
Content here.
```

```yaml
- block-started:
    type: div
    level: 1
    args: ["unclosed quote arg"]
- text-finished:
    lines: ["Content here."]
- block-finished
```

---

**Complex quote scenarios**

Test complex quoting scenarios with mixed patterns.

```wasot
.div .. "arg 1" unquoted "arg \"with\" quotes" final
Content here.
```

```yaml
- block-started:
    type: div
    level: 1
    args: ["arg 1", "unquoted", "arg \"with\" quotes", "final"]
- text-finished:
    lines: ["Content here."]
- block-finished
```

---

**Split on first equals outside quotes**

Test equals tokenizer splitting on first equals sign.

```wasot
.div .. key=value=more
Content here.
```

```yaml
- block-started:
    type: div
    level: 1
    kwargs:
      key: "value=more"
- text-finished:
    lines: ["Content here."]
- block-finished
```

---

**Quoted keys with equals**

Test equals parsing with quoted keys containing equals.

```wasot
.div .. "key=with=equals"=value
Content here.
```

```yaml
- block-started:
    type: div
    level: 1
    kwargs:
      key: with=equals=value
- text-finished:
    lines: ["Content here."]
- block-finished
```

---

**Quoted values with equals**

Test equals parsing with quoted values containing equals.

```wasot
.div .. key="value=with=equals"
Content here.
```

```yaml
- block-started:
    type: div
    level: 1
    kwargs:
      key: "value=with=equals"
- text-finished:
    lines: ["Content here."]
- block-finished
```

---

**No equals single token**

Test that tokens without equals remain as positional arguments.

```wasot
.div .. noequals
Content here.
```

```yaml
- block-started:
    type: div
    level: 1
    args: ["noequals"]
- text-finished:
    lines: ["Content here."]
- block-finished
```

---

**Complex equals parsing scenarios**

Test complex equals parsing with multiple patterns.

```wasot
.div .. arg1 key1=val1 arg2 "key 2"="val 2" key3=val3=extra
Content here.
```

```yaml
- block-started:
    type: div
    level: 1
    args: ["arg1", "arg2"]
    kwargs:
      key1: val1
      "key 2": "val 2"
      key3: val3=extra
- text-finished:
    lines: ["Content here."]
- block-finished
```

---

**Multiple dot separators**

Test ambiguous multiple dot separator handling.

```wasot
.div .. .. .. ..
Content here.
```

```yaml
- block-started:
    type: div
    level: 1
    args: ["..", "..", ".."]
- text-finished:
    lines: ["Content here."]
- block-finished
```

---

**Unclosed quote fallback**

Test unclosed quote handling in block types.

```wasot
."unclosed quote text
Content after unclosed quote.
```

```yaml
- block-started:
    type: "\"unclosed"
    level: 1
    inline-text: "quote text"
- text-finished:
    lines: ["Content after unclosed quote."]
- block-finished
```

---

**Multiple colon ID patterns**

Test handling of multiple colon patterns.

```wasot
.type :multiple :colons :here
Content with multiple colons.
```

```yaml
- block-started:
    type: type
    level: 1
    inline-text: ":multiple :colons"
- text-finished:
    lines: ["Content with multiple colons."]
- block-finished
```

---

**Empty components**

Test handling of empty components in meta-lines.

```wasot
."" "" .. "" ""="" :
Empty component content.
```

```yaml
- block-started:
    type: ""
    level: 1
    inline-text: ""
    args: ["", ":"]
    kwargs:
      "": ""
- block-finished
- text-finished:
    lines: ["Empty component content."]
```

---

**Whitespace-only block types**

Test handling of whitespace-only block types.

```wasot
." "
."  "
."	"
Content with whitespace types.
```

```yaml
- block-started:
    type: " "
    level: 1
- block-finished
- block-started:
    type: "  "
    level: 1
- block-finished
- block-started:
    type: "	"
    level: 1
- text-finished:
    lines: ["Content with whitespace types."]
- block-finished
```

---

**Edge case parameter parsing**

Test edge cases in parameter parsing.

```wasot
.test .. key= empty="" =single
Edge case content.
```

```yaml
- block-started:
    type: test
    level: 1
    kwargs:
      key: ""
      empty: ""
      "": single
- text-finished:
    lines: ["Edge case content."]
- block-finished
```

---

**Mixed separator patterns**

Test complex mixed separator patterns.

```wasot
.complex text .. .. param1 .. param2 .. .. param3
Complex separator content.
```

```yaml
- block-started:
    type: complex
    level: 1
    inline-text: "text "
    args: ["..", "param1", "..", "param2", "..", "..", "param3"]
- text-finished:
    lines: ["Complex separator content."]
- block-finished
```

---

**Large number of arguments**

Test handling of a large number of positional arguments.

```wasot
.test .. arg1 arg2 arg3 arg4 arg5 arg6 arg7 arg8 arg9 arg10 arg11 arg12 arg13 arg14 arg15 arg16 arg17 arg18 arg19 arg20 arg21 arg22 arg23 arg24 arg25 arg26 arg27 arg28 arg29 arg30
Content with many arguments.
```

```yaml
- block-started:
    type: test
    level: 1
    args: ["arg1", "arg2", "arg3", "arg4", "arg5", "arg6", "arg7", "arg8", "arg9", "arg10", "arg11", "arg12", "arg13", "arg14", "arg15", "arg16", "arg17", "arg18", "arg19", "arg20", "arg21", "arg22", "arg23", "arg24", "arg25", "arg26", "arg27", "arg28", "arg29", "arg30"]
- text-finished:
    lines: ["Content with many arguments."]
- block-finished
```

---

**Large number of child blocks**

Test blocks with many child elements.

```wasot
.container
..child1
..child2
..child3
..child4
..child5
..child6
..child7
..child8
..child9
..child10
..child11
..child12
..child13
..child14
..child15
Final child content.
```

```yaml
- block-started:
    type: container
    level: 1
- block-started:
    type: child1
    level: 2
- block-finished
- block-started:
    type: child2
    level: 2
- block-finished
- block-started:
    type: child3
    level: 2
- block-finished
- block-started:
    type: child4
    level: 2
- block-finished
- block-started:
    type: child5
    level: 2
- block-finished
- block-started:
    type: child6
    level: 2
- block-finished
- block-started:
    type: child7
    level: 2
- block-finished
- block-started:
    type: child8
    level: 2
- block-finished
- block-started:
    type: child9
    level: 2
- block-finished
- block-started:
    type: child10
    level: 2
- block-finished
- block-started:
    type: child11
    level: 2
- block-finished
- block-started:
    type: child12
    level: 2
- block-finished
- block-started:
    type: child13
    level: 2
- block-finished
- block-started:
    type: child14
    level: 2
- block-finished
- block-started:
    type: child15
    level: 2
- text-finished:
    lines: ["Final child content."]
- block-finished
- block-finished
```

---

**Maximum reasonable nesting depth**

Test maximum reasonable nesting depth without hitting limits.

```wasot
.level1
..level2
...level3
....level4
.....level5
......level6
.......level7
........level8
.........level9
..........level10
Content at maximum depth.
```

```yaml
- block-started:
    type: level1
    level: 1
- block-started:
    type: level2
    level: 2
- block-started:
    type: level3
    level: 3
- block-started:
    type: level4
    level: 4
- block-started:
    type: level5
    level: 5
- block-started:
    type: level6
    level: 6
- block-started:
    type: level7
    level: 7
- block-started:
    type: level8
    level: 8
- block-started:
    type: level9
    level: 9
- block-started:
    type: level10
    level: 10
- text-finished:
    lines: ["Content at maximum depth."]
- block-finished
- block-finished
- block-finished
- block-finished
- block-finished
- block-finished
- block-finished
- block-finished
- block-finished
- block-finished
```

---

**Very long block type names**

Test handling of very long block type names.

```wasot
.very-long-block-type-name-that-exceeds-normal-expectations-for-block-type-length-but-should-still-be-handled-correctly
Content with very long block type.
```

```yaml
- block-started:
    type: "very-long-block-type-name-that-exceeds-normal-expectations-for-block-type-length-but-should-still-be-handled-correctly"
    level: 1
- text-finished:
    lines: ["Content with very long block type."]
- block-finished
```

---

**Complex nested structures with siblings**

Test complex nesting with multiple siblings at each level.

```wasot
.root
..branch1
...leaf1
...leaf2
..branch2
...leaf3
...leaf4
..branch3
...leaf5
Final nested content.
```

```yaml
- block-started:
    type: root
    level: 1
- block-started:
    type: branch1
    level: 2
- block-started:
    type: leaf1
    level: 3
- block-finished
- block-started:
    type: leaf2
    level: 3
- block-finished
- block-finished
- block-started:
    type: branch2
    level: 2
- block-started:
    type: leaf3
    level: 3
- block-finished
- block-started:
    type: leaf4
    level: 3
- block-finished
- block-finished
- block-started:
    type: branch3
    level: 2
- block-started:
    type: leaf5
    level: 3
- text-finished:
    lines: ["Final nested content."]
- block-finished
- block-finished
- block-finished
```

---

**Mixed line ending types**

Test handling of different line ending types.

```wasot
.mixed-endings
Line with LF ending.
Line with potential CR handling.
Line with mixed content.
```

```yaml
- block-started:
    type: "mixed-endings"
    level: 1
- text-finished:
    lines:
      - "Line with LF ending."
      - "Line with potential CR handling."
      - "Line with mixed content."
- block-finished
```

---

**Complex whitespace handling**

Test various whitespace scenarios.

```wasot
.whitespace   
	Content with tabs and trailing spaces.  
   Content with leading spaces.
Content with normal spacing.
```

```yaml
- block-started:
    type: whitespace
    level: 1
    inline-text: "  "
- text-finished:
    lines:
      - "	Content with tabs and trailing spaces.  "
      - "   Content with leading spaces."
      - "Content with normal spacing."
- block-finished
```

---

**Error recovery patterns**

Test parser recovery from malformed syntax.

```wasot
.valid
Valid content.
not a meta line
.another-valid
More valid content after error.
```

```yaml
- block-started:
    type: valid
    level: 1
- text-finished:
    lines: ["Valid content.", "not a meta line"]
- block-finished
- block-started:
    type: "another-valid"
    level: 1
- text-finished:
    lines: ["More valid content after error."]
- block-finished
```

---

**Boundary Unicode characters**

Test Unicode boundary characters and combining sequences.

```wasot
.unicode-test
Content with ñoéü characters.
Content with 🌟⭐✨ emojis.
Content with αβγδε Greek letters.
```

```yaml
- block-started:
    type: "unicode-test"
    level: 1
- text-finished:
    lines:
      - "Content with ñoéü characters."
      - "Content with 🌟⭐✨ emojis."
      - "Content with αβγδε Greek letters."
- block-finished
```

---

**Complex quote nesting scenarios**

Test deeply nested quote scenarios in arguments.

```wasot
.complex .. arg="value with \"nested \\\"quotes\\\" inside\""
Content with complex quoting.
```

```yaml
- block-started:
    type: complex
    level: 1
    kwargs:
      arg: "value with \"nested \"quotes\" inside\""
- text-finished:
    lines: ["Content with complex quoting."]
- block-finished
```

---

**Blog post structure**

Test a realistic blog post with headers, content, links, and footnotes.

```wasot
.article :blog-post-123
.# Modern Web Development
This article discusses modern web development practices.

..section :introduction
Web development has evolved significantly over the past decade. 
Visit ((MDN Web Docs|https://developer.mozilla.org)) for comprehensive documentation.

..section :best-practices
Here are some key practices [1]:
- Use semantic HTML
- Implement responsive design
- Optimize for performance

*1 Based on industry standards and experience.
```

```yaml
- block-started:
    type: article
    level: 1
    id: "blog-post-123"
- block-finished
- block-started:
    type: "#"
    level: 1
    inline-text: "Modern Web Development"
- text-finished:
    lines: ["This article discusses modern web development practices.", ""]
- block-started:
    type: section
    level: 2
    id: introduction
- text-finished:
    lines: ["Web development has evolved significantly over the past decade. ", "Visit ((MDN Web Docs|https://developer.mozilla.org)) for comprehensive documentation.", ""]
- block-finished
- block-started:
    type: section
    level: 2
    id: "best-practices"
- text-finished:
    lines: ["Here are some key practices [1]:", "- Use semantic HTML", "- Implement responsive design", "- Optimize for performance", "", "*1 Based on industry standards and experience."]
- block-finished
- block-finished
```

---

**API documentation structure**

Test API documentation with code blocks and nested parameters.

```wasot
.api-doc :user-endpoint
.# User Management API

..endpoint .. method="POST" path="/api/users" :create-user
Create a new user account.

...request .. content-type="application/json"
{
  "username": "john_doe",
  "email": "john@example.com"
}

...response .. status="201" type="success"
{
  "id": 12345,
  "username": "john_doe",
  "created_at": "2023-01-01T00:00:00Z"
}
```

```yaml
- block-started:
    type: "api-doc"
    level: 1
    id: "user-endpoint"
- block-finished
- block-started:
    type: "#"
    level: 1
    inline-text: "User Management API"
- text-finished:
    lines: [""]
- block-started:
    type: endpoint
    level: 2
    id: "create-user"
    kwargs:
      method: "POST"
      path: "/api/users"
- text-finished:
    lines: ["Create a new user account.", ""]
- block-started:
    type: request
    level: 3
    kwargs:
      "content-type": "application/json"
- text-finished:
    lines: ["{", "  \"username\": \"john_doe\",", "  \"email\": \"john@example.com\"", "}", ""]
- block-finished
- block-started:
    type: response
    level: 3
    kwargs:
      status: "201"
      type: "success"
- text-finished:
    lines: ["{", "  \"id\": 12345,", "  \"username\": \"john_doe\",", "  \"created_at\": \"2023-01-01T00:00:00Z\"", "}"]
- block-finished
- block-finished
- block-finished
```

---

**Configuration file structure**

Test complex configuration with nested structures and various data types.

```wasot
.config :app-settings
..database .. engine="postgresql" host="localhost" port=5432
...connection .. pool-size=10 timeout=30
...credentials .. user="app_user" password="secure_pass"

..cache .. type="redis" enabled=true
...redis .. host="127.0.0.1" port=6379 db=0

..logging .. level="info" format="json"
...handlers .. console=true file=true syslog=false
```

```yaml
- block-started:
    type: config
    level: 1
    id: "app-settings"
- block-started:
    type: database
    level: 2
    kwargs:
      engine: postgresql
      host: localhost
      port: "5432"
- block-started:
    type: connection
    level: 3
    kwargs:
      "pool-size": "10"
      timeout: "30"
- block-finished
- block-started:
    type: credentials
    level: 3
    kwargs:
      user: app_user
      password: secure_pass
- text-finished:
    lines: [""]
- block-finished
- block-finished
- block-started:
    type: cache
    level: 2
    kwargs:
      type: redis
      enabled: "true"
- block-started:
    type: redis
    level: 3
    kwargs:
      host: "127.0.0.1"
      port: "6379"
      db: "0"
- text-finished:
    lines: [""]
- block-finished
- block-finished
- block-started:
    type: logging
    level: 2
    kwargs:
      level: info
      format: json
- block-started:
    type: handlers
    level: 3
    kwargs:
      console: "true"
      file: "true"
      syslog: "false"
- block-finished
- block-finished
- block-finished
```

---

**Multi-language content**

Test document with multiple languages and Unicode scripts.

```wasot
.document :multilingual
.# Welcome - 欢迎 - مرحبا - स्वागत

..section .. lang="en" :english
Hello World! Visit ((Example|https://example.com)) for more information.

..section .. lang="zh" :chinese
你好世界！这是中文内容。包含一些((链接|https://example.cn))。

..section .. lang="ar" :arabic
مرحبا بالعالم! هذا محتوى باللغة العربية.

..section .. lang="hi" :hindi
नमस्ते दुनिया! यह हिंदी सामग्री है।
```

```yaml
- block-started:
    type: document
    level: 1
    id: multilingual
- block-finished
- block-started:
    type: "#"
    level: 1
    inline-text: "Welcome - 欢迎 - مرحبا - स्वागत"
- text-finished:
    lines: [""]
- block-started:
    type: section
    level: 2
    id: english
    kwargs:
      lang: en
- text-finished:
    lines: ["Hello World! Visit ((Example|https://example.com)) for more information.", ""]
- block-finished
- block-started:
    type: section
    level: 2
    id: chinese
    kwargs:
      lang: zh
- text-finished:
    lines: ["你好世界！这是中文内容。包含一些((链接|https://example.cn))。", ""]
- block-finished
- block-started:
    type: section
    level: 2
    id: arabic
    kwargs:
      lang: ar
- text-finished:
    lines: ["مرحبا بالعالم! هذا محتوى باللغة العربية.", ""]
- block-finished
- block-started:
    type: section
    level: 2
    id: hindi
    kwargs:
      lang: hi
- text-finished:
    lines: ["नमस्ते दुनिया! यह हिंदी सामग्री है।"]
- block-finished
- block-finished
```

---

**Complex form definition**

Test form with all argument types and validation rules.

```wasot
.form .. method="POST" action="/submit" enctype="multipart/form-data" :contact-form
..fieldset User Information :user-info
...input .. type="text" name="username" required=true placeholder="Enter username" maxlength=50
...input .. type="email" name="email" required=true validation="email"
...textarea .. name="message" rows=5 cols=40 placeholder="Your message here"

..fieldset Preferences :preferences  
...select .. name="country" required=true
....option .. value="us" selected=true United States
....option .. value="ca" Canada
....option .. value="uk" United Kingdom

...input .. type="checkbox" name="newsletter" value="yes" Subscribe to newsletter
```

```yaml
- block-started:
    type: form
    level: 1
    id: "contact-form"
    kwargs:
      method: POST
      action: /submit
      enctype: "multipart/form-data"
- block-started:
    type: fieldset
    level: 2
    id: "user-info"
    inline-text: "User Information"
- block-started:
    type: input
    level: 3
    kwargs:
      type: text
      name: username
      required: "true"
      placeholder: "Enter username"
      maxlength: "50"
- block-finished
- block-started:
    type: input
    level: 3
    kwargs:
      type: email
      name: email
      required: "true"
      validation: email
- block-finished
- block-started:
    type: textarea
    level: 3
    kwargs:
      name: message
      rows: "5"
      cols: "40"
      placeholder: "Your message here"
- text-finished:
    lines: [""]
- block-finished
- block-finished
- block-started:
    type: fieldset
    level: 2
    inline-text: Preferences
- block-started:
    type: select
    level: 3
    kwargs:
      name: country
      required: "true"
- block-started:
    type: option
    level: 4
    args: ["United", "States"]
    kwargs:
      value: us
      selected: "true"
- block-finished
- block-started:
    type: option
    level: 4
    args: ["Canada"]
    kwargs:
      value: ca
- block-finished
- block-started:
    type: option
    level: 4
    args: ["United", "Kingdom"]
    kwargs:
      value: uk
- text-finished:
    lines: [""]
- block-finished
- block-finished
- block-started:
    type: input
    level: 3
    args: ["Subscribe", "to", "newsletter"]
    kwargs:
      type: checkbox
      name: newsletter
      value: "yes"
- block-finished
- block-finished
- block-finished
```

---

**Rich text document**

Test rich text with inline formatting and complex links.

```wasot
.document :rich-text
.# Advanced Typography

..paragraph
This paragraph contains ((emphasis|em)) and ((strong text|strong)) formatting.
You can also include ((code snippets|code)) and ((mathematical expressions|math)).

..paragraph 
For more information, see ((Section 5.2|#section-5-2)) or visit the ((official documentation|https://docs.example.com/advanced#typography)) online.

..paragraph
Complex links with parameters: ((Submit Form|action://submit .. method="POST" class="btn-primary")).
```

```yaml
- block-started:
    type: document
    level: 1
    id: "rich-text"
- block-finished
- block-started:
    type: "#"
    level: 1
    inline-text: "Advanced Typography"
- text-finished:
    lines: [""]
- block-started:
    type: paragraph
    level: 2
- text-finished:
    lines: ["This paragraph contains ((emphasis|em)) and ((strong text|strong)) formatting.", "You can also include ((code snippets|code)) and ((mathematical expressions|math)).", ""]
- block-finished
- block-started:
    type: paragraph
    level: 2
- text-finished:
    lines: ["For more information, see ((Section 5.2|#section-5-2)) or visit the ((official documentation|https://docs.example.com/advanced#typography)) online.", ""]
- block-finished
- block-started:
    type: paragraph
    level: 2
- text-finished:
    lines: ["Complex links with parameters: ((Submit Form|action://submit .. method=\"POST\" class=\"btn-primary\"))."]
- block-finished
- block-finished
```

---

**Hierarchical menu structure**

Test complex menu with IDs, parameters, and nested items.

```wasot
.navigation :main-menu
..menu-group File :file-menu
...menu-item .. action="new" shortcut="Ctrl+N" :new-file New Document
...menu-item .. action="open" shortcut="Ctrl+O" :open-file Open Document
...separator
...menu-item .. action="save" shortcut="Ctrl+S" :save-file Save Document

..menu-group Edit :edit-menu
...menu-item .. action="undo" shortcut="Ctrl+Z" :undo Undo
...menu-item .. action="redo" shortcut="Ctrl+Y" :redo Redo
...separator
...menu-item .. action="cut" shortcut="Ctrl+X" :cut Cut
...menu-item .. action="copy" shortcut="Ctrl+C" :copy Copy
```

```yaml
- block-started:
    type: navigation
    level: 1
    id: "main-menu"
- block-started:
    type: "menu-group"
    level: 2
    id: "file-menu"
    inline-text: File
- block-started:
    type: "menu-item"
    level: 3
    args: [":new-file", "New", "Document"]
    kwargs:
      action: new
      shortcut: Ctrl+N
- block-finished
- block-started:
    type: "menu-item"
    level: 3
    args: [":open-file", "Open", "Document"]
    kwargs:
      action: open
      shortcut: Ctrl+O
- block-finished
- block-started:
    type: separator
    level: 3
- block-finished
- block-started:
    type: "menu-item"
    level: 3
    args: [":save-file", "Save", "Document"]
    kwargs:
      action: save
      shortcut: Ctrl+S
- text-finished:
    lines: [""]
- block-finished
- block-finished
- block-started:
    type: "menu-group"
    level: 2
    id: "edit-menu"
    inline-text: Edit
- block-started:
    type: "menu-item"
    level: 3
    args: [":undo", "Undo"]
    kwargs:
      action: undo
      shortcut: Ctrl+Z
- block-finished
- block-started:
    type: "menu-item"
    level: 3
    args: [":redo", "Redo"]
    kwargs:
      action: redo
      shortcut: Ctrl+Y
- block-finished
- block-started:
    type: separator
    level: 3
- block-finished
- block-started:
    type: "menu-item"
    level: 3
    args: [":cut", "Cut"]
    kwargs:
      action: cut
      shortcut: Ctrl+X
- block-finished
- block-started:
    type: "menu-item"
    level: 3
    args: [":copy", "Copy"]
    kwargs:
      action: copy
      shortcut: Ctrl+C
- block-finished
- block-finished
- block-finished
```

---

**Data visualization markup**

Test data visualization with complex attributes and nested data.

```wasot
.visualization .. type="chart" engine="d3" :sales-chart
..chart .. chart-type="bar" width=800 height=600
...title Sales Data Q1 2023
...axis .. type="x" label="Months"
...axis .. type="y" label="Revenue ($)"

..dataset :q1-sales
...data-point .. month="Jan" revenue=125000 :jan-data
...data-point .. month="Feb" revenue=145000 :feb-data  
...data-point .. month="Mar" revenue=155000 :mar-data

..styling .. theme="professional" colors="blue,green,orange"
...legend .. position="top-right" show=true
```

```yaml
- block-started:
    type: visualization
    level: 1
    id: "sales-chart"
    kwargs:
      type: chart
      engine: d3
- block-started:
    type: chart
    level: 2
    kwargs:
      "chart-type": bar
      width: "800"
      height: "600"
- block-started:
    type: title
    level: 3
    inline-text: "Sales Data Q1 2023"
- block-finished
- block-started:
    type: axis
    level: 3
    kwargs:
      type: x
      label: Months
- block-finished
- block-started:
    type: axis
    level: 3
    kwargs:
      type: y
      label: "Revenue ($)"
- text-finished:
    lines: [""]
- block-finished
- block-finished
- block-started:
    type: dataset
    level: 2
    id: "q1-sales"
- block-started:
    type: "data-point"
    level: 3
    id: "jan-data"
    kwargs:
      month: Jan
      revenue: "125000"
- block-finished
- block-started:
    type: "data-point"
    level: 3
    id: "feb-data"
    kwargs:
      month: Feb
      revenue: "145000"
- block-finished
- block-started:
    type: "data-point"
    level: 3
    id: "mar-data"
    kwargs:
      month: Mar
      revenue: "155000"
- text-finished:
    lines: [""]
- block-finished
- block-finished
- block-started:
    type: styling
    level: 2
    kwargs:
      theme: professional
      colors: "blue,green,orange"
- block-started:
    type: legend
    level: 3
    kwargs:
      position: "top-right"
      show: "true"
- block-finished
- block-finished
- block-finished
```

---

**Mixed content types integration**

Test document combining various content types in realistic scenario.

```wasot
.specification :technical-spec
.# Product Requirements Document

..overview :project-overview
This document outlines the technical specifications for the new web application.
See ((Architecture Document|docs/architecture.md)) for system design details.

..requirements :functional-reqs
...requirement .. priority="high" category="authentication" :auth-req
Users must be able to log in using email and password.

...requirement .. priority="medium" category="ui" :ui-req  
Interface should support both light and dark themes.

..technical-details :tech-stack
...database .. type="postgresql" version="14+" host="db.example.com"
...api .. framework="fastapi" version="0.68+" language="python"
...frontend .. framework="react" version="18+" bundler="vite"

..appendix :references
*1 See ((OWASP Guidelines|https://owasp.org)) for security standards.
*2 Refer to ((API Documentation|/api/docs)) for endpoint details.
```

```yaml
- block-started:
    type: specification
    level: 1
    id: "technical-spec"
- block-finished
- block-started:
    type: "#"
    level: 1
    inline-text: "Product Requirements Document"
- text-finished:
    lines: [""]
- block-started:
    type: overview
    level: 2
    id: "project-overview"
- text-finished:
    lines:
      - "This document outlines the technical specifications for the new web application."
      - "See ((Architecture Document|docs/architecture.md)) for system design details."
      - ""
    links:
      - line: 1
        links:
            name: "Architecture Document|docs/architecture.md"
            start: 4
            length: 46
- block-finished
- block-started:
    type: requirements
    level: 2
    id: "functional-reqs"
- block-started:
    type: requirement
    level: 3
    id: "auth-req"
    kwargs:
      priority: high
      category: authentication
- text-finished:
    lines:
      - "Users must be able to log in using email and password."
      - ""
- block-finished
- block-started:
    type: requirement
    level: 3
    id: "ui-req"
    kwargs:
      priority: medium
      category: ui
- text-finished:
    lines:
      - "Interface should support both light and dark themes."
      - ""
- block-finished
- block-finished
- block-started:
    type: "technical-details"
    level: 2
    id: "tech-stack"
- block-started:
    type: database
    level: 3
    kwargs:
      type: postgresql
      version: "14+"
      host: "db.example.com"
- block-finished
- block-started:
    type: api
    level: 3
    kwargs:
      framework: fastapi
      version: "0.68+"
      language: python
- block-finished
- block-started:
    type: frontend
    level: 3
    kwargs:
      framework: react
      version: 18+
      bundler: vite
- text-finished:
    lines: [""]
- block-finished
- block-finished
- block-started:
    type: appendix
    level: 2
- text-finished:
    lines:
      - "*1 See ((OWASP Guidelines|https://owasp.org)) for security standards."
      - "*2 Refer to ((API Documentation|/api/docs)) for endpoint details."
    links:
      - line: 0
        links:
            name: "OWASP Guidelines|https://owasp.org"
            start: 7
            length: 38
      - line: 1
        links:
            name: "API Documentation|/api/docs"
            start: 12
            length: 31
    footnotes:
      - marker: 1
        link: "See ((OWASP Guidelines|https://owasp.org)) for security standards."
      - marker: 2
        link: "Refer to ((API Documentation|/api/docs)) for endpoint details."
- block-finished
- block-finished
```

---

**Cross-referencing with IDs**

Test document with extensive cross-references between blocks.

```wasot
.tutorial :advanced-tutorial
.# Advanced Web Development Tutorial

..section :intro
Welcome to this tutorial. We'll cover ((CSS Grid|#css-grid)) and ((Flexbox|#flexbox)) techniques.

..section .. topic="layout" :css-grid
CSS Grid Layout
Grid is perfect for two-dimensional layouts. See ((practical examples|#grid-examples)) below.

..section .. topic="layout" :flexbox  
Flexbox Layout
Flexbox excels at one-dimensional layouts. Check out ((flex examples|#flex-examples)) for more.

..examples :grid-examples
Grid Examples
...example .. type="code" language="css" :grid-basic
.container { display: grid; grid-template-columns: 1fr 2fr; }

..examples :flex-examples
Flexbox Examples  
...example .. type="code" language="css" :flex-basic
.container { display: flex; justify-content: center; }

..summary :conclusion
This tutorial covered ((grid layout|#css-grid)) and ((flexbox|#flexbox)). 
Review the ((grid examples|#grid-examples)) and ((flex examples|#flex-examples)) as needed.
```

```yaml
- block-started:
    type: tutorial
    level: 1
    id: "advanced-tutorial"
- block-finished
- block-started:
    type: "#"
    level: 1
    inline-text: "Advanced Web Development Tutorial"
- text-finished:
    lines: [""]
- block-started:
    type: section
    level: 2
    id: intro
- text-finished:
    lines: ["Welcome to this tutorial. We'll cover ((CSS Grid|#css-grid)) and ((Flexbox|#flexbox)) techniques.", ""]
- block-finished
- block-started:
    type: section
    level: 2
    id: "css-grid"
    kwargs:
      topic: "layout"
- text-finished:
    lines: ["CSS Grid Layout", "Grid is perfect for two-dimensional layouts. See ((practical examples|#grid-examples)) below.", ""]
- block-finished
- block-started:
    type: section
    level: 2
    id: flexbox
    kwargs:
      topic: "layout"
- text-finished:
    lines: ["Flexbox Layout", "Flexbox excels at one-dimensional layouts. Check out ((flex examples|#flex-examples)) for more.", ""]
- block-finished
- block-started:
    type: examples
    level: 2
    id: "grid-examples"
- text-finished:
    lines: ["Grid Examples"]
- block-started:
    type: example
    level: 3
    id: "grid-basic"
    kwargs:
      type: "code"
      language: "css"
- block-finished
- block-finished
- block-finished
- block-started:
    type: container
    level: 1
    inline-text: "{ display: grid; grid-template-columns: 1fr 2fr; }"
- text-finished:
    lines: [""]
- block-started:
    type: examples
    level: 2
    id: "flex-examples"
- text-finished:
    lines: ["Flexbox Examples  "]
- block-started:
    type: example
    level: 3
    id: "flex-basic"
    kwargs:
      type: "code"
      language: "css"
- block-finished
- block-finished
- block-finished
- block-started:
    type: container
    level: 1
    inline-text: "{ display: flex; justify-content: center; }"
- text-finished:
    lines: [""]
- block-started:
    type: summary
    level: 2
    id: conclusion
- text-finished:
    lines: ["This tutorial covered ((grid layout|#css-grid)) and ((flexbox|#flexbox)). ", "Review the ((grid examples|#grid-examples)) and ((flex examples|#flex-examples)) as needed."]
- block-finished
- block-finished
```

---

**Escaped content in complex structures**

Test proper escaping within complex nested structures.

```wasot
.documentation :escape-examples
..code-block .. language="javascript" :js-example
function processData(input) {
  const pattern = /\".*\"/g;
  const escaped = input.replace(/\"/g, '\\"');
  return `Result: \"${escaped}\"`;
}

..config-example .. format="json" :json-config
{
  "server": {
    "host": "localhost",
    "port": 8080,
    "ssl": {
      "cert": "/path/to/\"certificate\".pem",
      "key": "/path/to/\"private-key\".pem"
    }
  }
}

..template-example .. type="html" :html-template
<div class="container">
  <p>Quote: \"Success is 1% inspiration, 99% perspiration.\"</p>
  <code>console.log(\"Hello, \\\"World\\\"!\");</code>
</div>
```

```yaml
- block-started:
    type: documentation
    level: 1
    id: "escape-examples"
- block-started:
    type: "code-block"
    level: 2
    id: "js-example"
    kwargs:
      language: javascript
- text-finished:
    lines:
      - "function processData(input) {"
      - "  const pattern = /\\\".*\\\"/g;"
      - "  const escaped = input.replace(/\\\"/g, '\\\\\"');"
      - "  return `Result: \\\"${escaped}\\\"`;"
      - "}"
      - ""
- block-finished
- block-started:
    type: "config-example"
    level: 2
    id: "json-config"
    kwargs:
      format: json
- text-finished:
    lines:
      - "{"
      - "  \"server\": {"
      - "    \"host\": \"localhost\","
      - "    \"port\": 8080,"
      - "    \"ssl\": {"
      - "      \"cert\": \"/path/to/\\\"certificate\\\".pem\","
      - "      \"key\": \"/path/to/\\\"private-key\\\".pem\""
      - "    }"
      - "  }"
      - "}"
      - ""
- block-finished
- block-started:
    type: "template-example"
    level: 2
    id: "html-template"
    kwargs:
      type: html
- text-finished:
    lines:
      - "<div class=\"container\">"
      - "  <p>Quote: \\\"Success is 1% inspiration, 99% perspiration.\\\"</p>"
      - "  <code>console.log(\\\"Hello, \\\\\\\"World\\\\\\\"!\\\");</code>"
      - "</div>"
- block-finished
- block-finished
```

---

**Large document performance**

Test large document with many blocks for performance validation.

```wasot
.large-document :performance-test
.# Performance Test Document

..section :bulk-content
This section contains many repetitive blocks to test parsing performance.

...item .. index=1 category="test" Item 1 content
...item .. index=2 category="test" Item 2 content  
...item .. index=3 category="test" Item 3 content
...item .. index=4 category="test" Item 4 content
...item .. index=5 category="test" Item 5 content
...item .. index=6 category="test" Item 6 content
...item .. index=7 category="test" Item 7 content
...item .. index=8 category="test" Item 8 content
...item .. index=9 category="test" Item 9 content
...item .. index=10 category="test" Item 10 content

..section :performance-metrics
This document tests parser performance with multiple blocks, various nesting levels, and mixed content types.
Each item above has parameters and content to ensure comprehensive testing.
```

```yaml
- block-started:
    type: "large-document"
    level: 1
    id: "performance-test"

- block-finished
- block-started:
    type: "#"
    level: 1
    inline-text: "Performance Test Document"

- text-finished:
    lines: [""]

- block-started:
    type: section
    level: 2
    id: "bulk-content"

- text-finished:
    lines:
      - "This section contains many repetitive blocks to test parsing performance."
      - ""

- block-started:
    type: item
    level: 3
    args: ["Item", "1", "content"]
    kwargs:
      index: "1"
      category: test

- block-finished
- block-started:
    type: item
    level: 3
    args: ["Item", "2", "content"]
    kwargs:
      index: "2"
      category: test

- block-finished
- block-started:
    type: item
    level: 3
    args: ["Item", "3", "content"]
    kwargs:
      index: "3"
      category: test

- block-finished
- block-started:
    type: item
    level: 3
    args: ["Item", "4", "content"]
    kwargs:
      index: "4"
      category: test

- block-finished
- block-started:
    type: item
    level: 3
    args: ["Item", "5", "content"]
    kwargs:
      index: "5"
      category: test

- block-finished
- block-started:
    type: item
    level: 3
    args: ["Item", "6", "content"]
    kwargs:
      index: "6"
      category: test

- block-finished
- block-started:
    type: item
    level: 3
    args: ["Item", "7", "content"]
    kwargs:
      index: "7"
      category: test

- block-finished
- block-started:
    type: item
    level: 3
    args: ["Item", "8", "content"]
    kwargs:
      index: "8"
      category: test

- block-finished
- block-started:
    type: item
    level: 3
    args: ["Item", "9", "content"]
    kwargs:
      index: "9"
      category: test

- block-finished
- block-started:
    type: item
    level: 3
    args: ["Item", "10", "content"]
    kwargs:
      index: "10"
      category: test

- text-finished:
    lines: [""]

- block-finished
- block-finished
- block-started:
    type: section
    level: 2
    id: "performance-metrics"

- text-finished:
    lines:
      - "This document tests parser performance with multiple blocks, various nesting levels, and mixed content types."
      - "Each item above has parameters and content to ensure comprehensive testing."

- block-finished
- block-finished
```

---

**Non-adjacent text lines**

Test non-adjacent text lines that remain separate.

```wasot
.container
First text block.
..nested
Nested content.
Second text block.
```

```yaml
- block-started:
    type: container
    level: 1
- text-finished:
    lines: ["First text block."]
- block-started:
    type: nested
    level: 2
- text-finished:
    lines:
      - "Nested content."
      - "Second text block."
- block-finished
- block-finished
```

---

**URL links**

Test basic URL links in text content.

```wasot
.paragraph
Visit ((http://example.com)) for more info.
```

```yaml
- block-started:
    type: paragraph
    level: 1
- text-finished:
    lines: ["Visit ((http://example.com)) for more info."]
    links:
      - line: 0
        links:
            name: "http://example.com"
            start: 6
            length: 23
- block-finished
```

---

**Named links**

Test links with display names.

```wasot
.paragraph
Check out ((Example Site|http://example.com)) here.
```

```yaml
- block-started:
    type: paragraph
    level: 1
- text-finished:
    lines: ["Check out ((Example Site|http://example.com)) here."]
    links:
      - line: 0
        links:
            name: "Example Site|http://example.com"
            start: 10
            length: 35
- block-finished
```

---

**ID reference links**

Test links to other blocks by ID.

```wasot
.paragraph
See the ((:section-id)) for details.
```

```yaml
- block-started:
    type: paragraph
    level: 1
- text-finished:
    lines: ["See the ((:section-id)) for details."]
    links:
      - line: 0
        links:
          - target: "section-id"
            start: 8
            length: 15
- block-finished
```

---

**Footnote links**

Test footnote reference links.

```wasot
.paragraph
This needs a reference ((#)).
```

```yaml
- block-started:
    type: paragraph
    level: 1
- text-finished:
    lines: ["This needs a reference ((#))."]
    links:
      - line: 0
        links:
            name: "#"
            start: 24
            length: 5
- block-finished
```

---

**Links with arguments**

Test links that contain arguments.

```wasot
.paragraph
Click ((button .. type="submit" class="primary")) here.
```

```yaml
- block-started:
    type: paragraph
    level: 1
- text-finished:
    lines: ["Click ((button .. type=\"submit\" class=\"primary\")) here."]
    links:
      - line: 0
        links:
            name: button
            start: 6
            length: 43
- block-finished
```

---

**Multiple links per line**

Test multiple links in one line.

```wasot
.paragraph
Go to ((http://site1.com)) or ((http://site2.com)) now.
```

```yaml
- block-started:
    type: paragraph
    level: 1
- text-finished:
    lines: ["Go to ((http://site1.com)) or ((http://site2.com)) now."]
    links:
      - line: 0
        links:
            name: "http://site1.com"
            start: 6
            length: 21
            name: "http://site2.com"
            start: 31
            length: 21
- block-finished
```

---

**Nested parentheses in links**

Test links with nested parentheses.

```wasot
.paragraph
Check ((text with )) inside)) for info.
```

```yaml
- block-started:
    type: paragraph
    level: 1
- text-finished:
    lines: ["Check ((text with )) inside)) for info."]
    links:
      - line: 0
        links:
            name: "text with )) inside"
            start: 6
            length: 25
- block-finished
```

---

**Quoted content in links**

Test links with quoted content.

```wasot
.paragraph
See (("quoted content")) here.
```

```yaml
- block-started:
    type: paragraph
    level: 1
- text-finished:
    lines: ["See ((\"quoted content\")) here."]
    links:
      - line: 0
        links:
            name: "quoted content"
            start: 4
            length: 20
- block-finished
```

---

**Escaped quotes in links**

Test links with escaped quotes.

```wasot
.paragraph
Click ((text "escaped")) button.
```

```yaml
- block-started:
    type: paragraph
    level: 1
- text-finished:
    lines: ["Click ((text \"escaped\")) button."]
    links:
      - line: 0
        links:
            name: "text \"escaped\""
            start: 6
            length: 18
- block-finished
```

---

**Unclosed links**

Test handling of unclosed links.

```wasot
.paragraph
This has ((unclosed link text.
```

```yaml
- block-started:
    type: paragraph
    level: 1
- text-finished:
    lines: ["This has ((unclosed link text."]
    links:
      - line: 0
        links:
            name: "unclosed link text."
            start: 9
            length: 21
- block-finished
```

---

**Footnote marker**

Test footnote marker syntax.

```wasot
.paragraph
Reference text here.
*1 http://example.com
```

```yaml
- block-started:
    type: paragraph
    level: 1
- text-finished:
    lines:
      - "Reference text here."
      - "*1 http://example.com"
- block-finished
```

---

**Multiple footnotes**

Test multiple footnote markers.

```wasot
.paragraph
Text with references.
*1 http://site1.com
*2 http://site2.com
*3 http://site3.com
```

```yaml
- block-started:
    type: paragraph
    level: 1
- text-finished:
    lines:
      - "Text with references."
      - "*1 http://site1.com"
      - "*2 http://site2.com"
      - "*3 http://site3.com"
- block-finished
```

---

**Footnote with spaces**

Test footnote with spacing variations.

```wasot
.paragraph
Reference here.
*1    http://example.com
```

```yaml
- block-started:
    type: paragraph
    level: 1
- text-finished:
    lines:
      - "Reference here."
      - "*1    http://example.com"
- block-finished
```

---

**Invalid footnotes**

Test invalid footnote syntax.

```wasot
.paragraph
Invalid references.
* text without number
*1text without space
```

```yaml
- block-started:
    type: paragraph
    level: 1
- text-finished:
    lines:
      - "Invalid references."
      - "* text without number"
      - "*1text without space"
- block-finished
```

---

**Unclosed quotes at end of line**

Test handling of unclosed quotes.

```wasot
.paragraph
Text with "unclosed quote
```

```yaml
- block-started:
    type: paragraph
    level: 1
- text-finished:
    lines: ["Text with \"unclosed quote"]
- block-finished
```

---

**Mismatched quote types**

Test handling of mismatched quote types.

```wasot
.paragraph
Text with "double quote and single'
```

```yaml
- block-started:
    type: paragraph
    level: 1
- text-finished:
    lines: ["Text with \"double quote and single'"]
- block-finished
```

---

**Multiple quote levels**

Test nested quotes handling.

```wasot
.paragraph
Text with "outer "inner" outer" quotes.
```

```yaml
- block-started:
    type: paragraph
    level: 1
- text-finished:
    lines: ["Text with \"outer \"inner\" outer\" quotes."]
- block-finished
```

---

**Escaped quotes in text**

Test escaped quotes in text content.

```wasot
.paragraph
Text with \" escaped quote.
```

```yaml
- block-started:
    type: paragraph
    level: 1
- text-finished:
    lines: ["Text with \\\" escaped quote."]
- block-finished
```

---

**Escaped backslashes**

Test escaped backslashes in text.

```wasot
.paragraph
Text with \\ escaped backslash.
```

```yaml
- block-started:
    type: paragraph
    level: 1
- text-finished:
    lines: ["Text with \\\\ escaped backslash."]
- block-finished
```

---

**Quotes in block type context**

Test quotes in different contexts - block type.

```wasot
."quoted type" "inline text" .. "arg" key="value"
Content here.
```

```yaml
- block-started:
    type: "quoted type"
    level: 1
    inline-text: "inline text"
    inline-text-quoted: true
    args: ["arg"]
    kwargs:
      key: value
- text-finished:
    lines: ["Content here."]
- block-finished
```

---

**Escaped quotes in quoted strings**

Test escape sequences in quoted strings.

```wasot
.component .. title="Text with \" escaped quote"
Component content.
```

```yaml
- block-started:
    type: component
    level: 1
    kwargs:
      title: "Text with \" escaped quote"
- text-finished:
    lines: ["Component content."]
- block-finished
```

---

**Escaped quotes in unquoted context**

Test escaped quotes treated literally in unquoted context.

```wasot
.component .. title=text\"with\"quotes
Component content.
```

```yaml
- block-started:
    type: component
    level: 1
    kwargs:
      title: "text\\with\\quotes"
- text-finished:
    lines: ["Component content."]
- block-finished
```

---

**Double escape sequences**

Test double escape sequences.

```wasot
.paragraph
Text with \\\\" double escaped.
```

```yaml
- block-started:
    type: paragraph
    level: 1
- text-finished:
    lines: ["Text with \\\\\\\\\" double escaped."]
- block-finished
```

---

**Invalid escape sequences**

Test invalid escape sequences kept as-is.

```wasot
.paragraph
Text with \n newline and \t tab.
```

```yaml
- block-started:
    type: paragraph
    level: 1
- text-finished:
    lines: ["Text with \\n newline and \\t tab."]
- block-finished
```

---

**Zero-width characters**

Test zero-width Unicode characters.

```wasot
.paragraph
Text​with​zero​width​spaces.
```

```yaml
- block-started:
    type: paragraph
    level: 1
- text-finished:
    lines: ["Text​with​zero​width​spaces."]
- block-finished
```

---

**Right-to-left text**

Test right-to-left text support.

```wasot
.paragraph
العربية עברית text mixed.
```

```yaml
- block-started:
    type: paragraph
    level: 1
- text-finished:
    lines: ["العربية עברית text mixed."]
- block-finished
```

---

**Emoji with modifiers**

Test emoji with skin tone modifiers.

```wasot
.paragraph
Emoji with modifiers: 👋🏻👋🏿🤝🏽
```

```yaml
- block-started:
    type: paragraph
    level: 1
- text-finished:
    lines: ["Emoji with modifiers: 👋🏻👋🏿🤝🏽"]
- block-finished
```

---

**Combining characters**

Test Unicode combining characters.

```wasot
.paragraph
Combined: é ñ å characters.
```

```yaml
- block-started:
    type: paragraph
    level: 1
- text-finished:
    lines: ["Combined: é ñ å characters."]
- block-finished
```

---

**Control characters**

Test control characters in text.

```wasot
.paragraph
Text with control chars.
```

```yaml
- block-started:
    type: paragraph
    level: 1
- text-finished:
    lines: ["Text with control chars."]
- block-finished
```

---

**Meta-line with single dot**

Test basic meta-line detection with single dot.

```wasot
.div
Content here.
```

```yaml
- block-started:
    type: div
    level: 1
- text-finished:
    lines: ["Content here."]
- block-finished
```

---

**Meta-line with double dots**

Test meta-line detection with double dots for level 2.

```wasot
.outer
..inner
Inner content.
```

```yaml
- block-started:
    type: outer
    level: 1
- block-started:
    type: inner
    level: 2
- text-finished:
    lines: ["Inner content."]
- block-finished
- block-finished
```

---

**Meta-line with triple dots**

Test meta-line detection with triple dots for level 3.

```wasot
.level1
..level2
...level3
Deep content.
```

```yaml
- block-started:
    type: level1
    level: 1
- block-started:
    type: level2
    level: 2
- block-started:
    type: level3
    level: 3
- text-finished:
    lines: ["Deep content."]
- block-finished
- block-finished
- block-finished
```

---

**Line without leading dot**

Test that lines without leading dots are treated as text.

```wasot
.paragraph
This is text without a leading dot.
More text content.
```

```yaml
- block-started:
    type: paragraph
    level: 1
- text-finished:
    lines:
      - "This is text without a leading dot."
      - "More text content."
- block-finished
```

---

**Empty line handling**

Test handling of empty lines in text content.

```wasot
.paragraph
First line.

Second line after empty.
```

```yaml
- block-started:
    type: paragraph
    level: 1
- text-finished:
    lines:
      - "First line."
      - ""
      - "Second line after empty."
- block-finished
```

---

**Whitespace-only line**

Test handling of lines with only whitespace.

```wasot
.paragraph
Before whitespace.
   
After whitespace.
```

```yaml
- block-started:
    type: paragraph
    level: 1
- text-finished:
    lines:
      - "Before whitespace."
      - "   "
      - "After whitespace."
- block-finished
```

---

**Line with whitespace before dot**

Test that lines with whitespace before dot are treated as text.

```wasot
.paragraph
  .not-a-meta-line
Text content here.
```

```yaml
- block-started:
    type: paragraph
    level: 1
- text-finished:
    lines:
      - "  .not-a-meta-line"
      - "Text content here."
- block-finished
```

---

**Line with dot in middle**

Test that lines with dots not at start are treated as text.

```wasot
.paragraph
This has a . dot in the middle.
And this.has.multiple.dots.
```

```yaml
- block-started:
    type: paragraph
    level: 1
- text-finished:
    lines:
      - "This has a . dot in the middle."
      - "And this.has.multiple.dots."
- block-finished
```

---

**Just a single dot as empty type**

Test a single dot creates an empty-type block.

```wasot
.
Text content for empty type.
```

```yaml
- block-started:
    type: ""
    level: 1
- block-finished
- text-finished:
    lines: ["Text content for empty type."]
```

---

**Implicit close on same level**

Test implicit block closing when same level block starts.

```wasot
.first
First content.
.second
Second content.
```

```yaml
- block-started:
    type: first
    level: 1
- text-finished:
    lines: ["First content."]
- block-finished
- block-started:
    type: second
    level: 1
- text-finished:
    lines: ["Second content."]
- block-finished
```

---

**Implicit close on lower level**

Test implicit block closing when lower level block starts.

```wasot
.outer
..inner
Inner content.
.new-outer
New outer content.
```

```yaml
- block-started:
    type: outer
    level: 1
- block-started:
    type: inner
    level: 2
- text-finished:
    lines: ["Inner content."]
- block-finished
- block-finished
- block-started:
    type: new-outer
    level: 1
- text-finished:
    lines: ["New outer content."]
- block-finished
```

---

**Self-closing heading block**

Test self-closing blocks using hash syntax.

```wasot
.# Main Title
.paragraph
Following content.
```

```yaml
- block-started:
    type: "#"
    level: 1
    inline-text: "Main Title"
- block-finished
- block-started:
    type: paragraph
    level: 1
- text-finished:
    lines: ["Following content."]
- block-finished
```

---

**Implicit text block**

Test text content without preceding meta-line.

```wasot
This is implicit text content.
More implicit text.
.explicit
Explicit block content.
```

```yaml
- text-finished:
    lines:
      - "This is implicit text content."
      - "More implicit text."
- block-started:
    type: explicit
    level: 1
- text-finished:
    lines: ["Explicit block content."]
- block-finished
```

---

**Multiple dot levels mixed**

Test mixed nesting levels that skip intermediate levels.

```wasot
.level1
...level3
Level 3 content.
..level2
Level 2 content.
```

```yaml
- block-started:
    type: level1
    level: 1
- block-started:
    type: level3
    level: 3
- text-finished:
    lines: ["Level 3 content."]
- block-finished
- block-started:
    type: level2
    level: 2
- text-finished:
    lines: ["Level 2 content."]
- block-finished
- block-finished
```

---

**Arbitrary deep nesting**

Test deep nesting with many dot levels.

```wasot
.l1
..l2
...l3
....l4
.....l5
Deep content.
```

```yaml
- block-started:
    type: l1
    level: 1
- block-started:
    type: l2
    level: 2
- block-started:
    type: l3
    level: 3
- block-started:
    type: l4
    level: 4
- block-started:
    type: l5
    level: 5
- text-finished:
    lines: ["Deep content."]
- block-finished
- block-finished
- block-finished
- block-finished
- block-finished
```

---

**Root level implicit block**

Test implicit root level behavior with text.

```wasot
Root level text content.
.explicit
Explicit block content.
```

```yaml
- text-finished:
    lines: ["Root level text content."]
- block-started:
    type: explicit
    level: 1
- text-finished:
    lines: ["Explicit block content."]
- block-finished
```

---

**Single nesting pattern**

Test basic parent-child nesting relationship.

```wasot
.parent
Parent content.
..child
Child content.
```

```yaml
- block-started:
    type: parent
    level: 1
- text-finished:
    lines: ["Parent content."]
- block-started:
    type: child
    level: 2
- text-finished:
    lines: ["Child content."]
- block-finished
- block-finished
```

---

**Deep nesting sequential levels**

Test sequential nesting through multiple levels.

```wasot
.level1
..level2
...level3
....level4
.....level5
......level6
Content at level 6.
```

```yaml
- block-started:
    type: level1
    level: 1
- block-started:
    type: level2
    level: 2
- block-started:
    type: level3
    level: 3
- block-started:
    type: level4
    level: 4
- block-started:
    type: level5
    level: 5
- block-started:
    type: level6
    level: 6
- text-finished:
    lines: ["Content at level 6."]
- block-finished
- block-finished
- block-finished
- block-finished
- block-finished
- block-finished
```

---

**Reasonable deep nesting**

Test reasonable deep nesting (6 levels).

```wasot
.l1
..l2
...l3
....l4
.....l5
......l6
Deep content.
```

```yaml
- block-started:
    type: l1
    level: 1
- block-started:
    type: l2
    level: 2
- block-started:
    type: l3
    level: 3
- block-started:
    type: l4
    level: 4
- block-started:
    type: l5
    level: 5
- block-started:
    type: l6
    level: 6
- text-finished:
    lines: ["Deep content."]
- block-finished
- block-finished
- block-finished
- block-finished
- block-finished
- block-finished
```

---

**Mixed nesting with level skips**

Test nesting that skips intermediate levels.

```wasot
.level1
....level4
Level 4 content.
..level2
Level 2 content.
.......level7
Level 7 content.
```

```yaml
- block-started:
    type: level1
    level: 1
- block-started:
    type: level4
    level: 4
- text-finished:
    lines: ["Level 4 content."]
- block-finished
- block-started:
    type: level2
    level: 2
- text-finished:
    lines: ["Level 2 content."]
- block-started:
    type: level7
    level: 7
- text-finished:
    lines: ["Level 7 content."]
- block-finished
- block-finished
- block-finished
```

---

**Nested blocks with text between levels**

Test text content between different nesting levels.

```wasot
.container
Container text.
..section
Section text.
More container text.
```

```yaml
- block-started:
    type: container
    level: 1
- text-finished:
    lines: ["Container text."]
- block-started:
    type: section
    level: 2
- text-finished:
    lines:
      - "Section text."
      - "More container text."
- block-finished
- block-finished
```

---

**Nested blocks with empty parents**

Test nested blocks where parent has no content.

```wasot
.empty-parent
..child1
Child 1 content.
..child2
Child 2 content.
```

```yaml
- block-started:
    type: empty-parent
    level: 1
- block-started:
    type: child1
    level: 2
- text-finished:
    lines: ["Child 1 content."]
- block-finished
- block-started:
    type: child2
    level: 2
- text-finished:
    lines: ["Child 2 content."]
- block-finished
- block-finished
```

---

**Reverse nesting pattern**

Test nesting from deep to shallow levels.

```wasot
.....deep
Deep content.
...medium
Medium content.
.shallow
Shallow content.
```

```yaml
- block-started:
    type: deep
    level: 5
- text-finished:
    lines: ["Deep content."]
- block-finished
- block-started:
    type: medium
    level: 3
- text-finished:
    lines: ["Medium content."]
- block-finished
- block-started:
    type: shallow
    level: 1
- text-finished:
    lines: ["Shallow content."]
- block-finished
```

---

**Complex nesting patterns**

Test complex mixed nesting with various patterns.

```wasot
.root
..branch1
...leaf1
....deep-leaf
Branch 1 deep content.
..branch2
Branch 2 content.
...leaf2
Branch 2 leaf content.
```

```yaml
- block-started:
    type: root
    level: 1
- block-started:
    type: branch1
    level: 2
- block-started:
    type: leaf1
    level: 3
- block-started:
    type: deep-leaf
    level: 4
- text-finished:
    lines: ["Branch 1 deep content."]
- block-finished
- block-finished
- block-finished
- block-started:
    type: branch2
    level: 2
- text-finished:
    lines: ["Branch 2 content."]
- block-started:
    type: leaf2
    level: 3
- text-finished:
    lines: ["Branch 2 leaf content."]
- block-finished
- block-finished
- block-finished
```

---

**Nested self-closing blocks**

Test self-closing blocks at different nesting levels.

```wasot
.container
..# Section Title
...paragraph
Section content.
..# Another Section
```

```yaml
- block-started:
    type: container
    level: 1
- block-started:
    type: "#"
    level: 2
    inline-text: "Section Title"
- block-started:
    type: paragraph
    level: 3
- text-finished:
    lines: ["Section content."]
- block-finished
- block-finished
- block-started:
    type: "#"
    level: 2
    inline-text: "Another Section"
- block-finished
- block-finished
```

---

**Meta-line with trailing whitespace**

Test meta-lines with whitespace after the type.

```wasot
.div   
Content after whitespace.
..nested    
Nested content with whitespace.
```

```yaml
- block-started:
    type: div
    level: 1
- text-finished:
    lines: ["Content after whitespace."]
- block-started:
    type: nested
    level: 2
- text-finished:
    lines: ["Nested content with whitespace."]
- block-finished
- block-finished
```

---

**Meta-line edge case parsing**

Test edge cases in meta-line recognition.

```wasot
.
..
...type
Edge case content.
```

```yaml
- block-started:
    type: ""
    level: 1
- block-finished
- block-started:
    type: ""
    level: 2
- block-finished
- block-started:
    type: type
    level: 3
- text-finished:
    lines: ["Edge case content."]
- block-finished
```

---

**Block level consistency**

Test consistent level tracking across complex structures.

```wasot
.a
..b
...c
..d
.e
..f
Content at various levels.
```

```yaml
- block-started:
    type: a
    level: 1
- block-started:
    type: b
    level: 2
- block-started:
    type: c
    level: 3
- block-finished
- block-finished
- block-started:
    type: d
    level: 2
- block-finished
- block-finished
- block-started:
    type: e
    level: 1
- block-started:
    type: f
    level: 2
- text-finished:
    lines: ["Content at various levels."]
- block-finished
- block-finished
```

---

**Nesting with inline text and parameters**

Test nested blocks with meta-line features.

```wasot
.container Main container .. class="wrapper"
..section Section title .. id="main" :section-1
Section content here.
...subsection Subsection title .. role="content"
Subsection content.
```

```yaml
- block-started:
    type: container
    level: 1
    inline-text: "Main container "
    kwargs:
      class: wrapper
- block-started:
    type: section
    level: 2
    id: "section-1"
    inline-text: "Section title "
    kwargs:
      id: main
- text-finished:
    lines: ["Section content here."]
- block-started:
    type: subsection
    level: 3
    inline-text: "Subsection title "
    kwargs:
      role: content
- text-finished:
    lines: ["Subsection content."]
- block-finished
- block-finished
- block-finished
```

---

**Siblings at same nesting level**

Test multiple blocks at the same nesting level.

```wasot
.parent
..child1
Child 1 content.
..child2
Child 2 content.
..child3
Child 3 content.
```

```yaml
- block-started:
    type: parent
    level: 1
- block-started:
    type: child1
    level: 2
- text-finished:
    lines: ["Child 1 content."]
- block-finished
- block-started:
    type: child2
    level: 2
- text-finished:
    lines: ["Child 2 content."]
- block-finished
- block-started:
    type: child3
    level: 2
- text-finished:
    lines: ["Child 3 content."]
- block-finished
- block-finished
```

---

**Heading with type suffix**

Test a heading block with a type suffix after the hash.

```wasot
.# chapter
```

```yaml
- block-started:
    type: "#"
    level: 1
    inline-text: chapter
- block-finished
```

---

**Basic self-closing heading**

Test a basic self-closing heading block with no content.

```wasot
.#
```

```yaml
- block-started:
    type: "#"
    level: 1
- block-finished
```

---

**Self-closing heading with inline text**

Test a self-closing heading block with inline text.

```wasot
.# Some heading text
```

```yaml
- block-started:
    type: "#"
    level: 1
    inline-text: "Some heading text"
- block-finished
```

---

**Nested heading blocks**

Test a heading block nested within another block.

```wasot
.container
..# subsection
```

```yaml
- block-started:
    type: container
    level: 1
- block-started:
    type: "#"
    level: 2
    inline-text: subsection
- block-finished
- block-finished
```

---

**Heading with following text content**

Test a heading block followed by text content.

```wasot
.# heading
Some text content after heading.
```

```yaml
- block-started:
    type: "#"
    level: 1
    inline-text: heading
- text-finished:
    lines: ["Some text content after heading."]
- block-finished
```

---

**Heading with parameters**

Test a heading block with parameters.

```wasot
.# chapter .. param=value
```

```yaml
- block-started:
    type: "#"
    level: 1
    inline-text: "chapter "
    kwargs:
      param: value
- block-finished
```

---

**Block type with Unicode and emoji**

Test a block type containing Unicode characters and emoji.

```wasot
.émojis👨‍👩‍👧‍👦
```

```yaml
- block-started:
    type: émojis👨‍👩‍👧‍👦
    level: 1
- block-finished
```

---

**Block type with emoji only**

Test a block type consisting only of emoji characters.

```wasot
.👨‍👩‍👧‍👦
```

```yaml
- block-started:
    type: 👨‍👩‍👧‍👦
    level: 1
- block-finished
```

---

**Block type with Japanese characters**

Test a block type containing Japanese characters.

```wasot
.日本語
```

```yaml
- block-started:
    type: 日本語
    level: 1
- block-finished
```

---

**Block type with mixed Unicode**

Test a block type with mixed Unicode, Japanese, and emoji characters.

```wasot
.test日本語emoji👨‍👩‍👧‍👦
```

```yaml
- block-started:
    type: test日本語emoji👨‍👩‍👧‍👦
    level: 1
- block-finished
```

---

**Block type with unusual characters**

Test a block type with unusual character combinations.

```wasot
.type_with_underscores
```

```yaml
- block-started:
    type: type_with_underscores
    level: 1
- block-finished
```

---

**Block type with numbers and symbols**

Test a block type containing numbers and symbols.

```wasot
.type123_$symbol
```

```yaml
- block-started:
    type: type123_$symbol
    level: 1
- block-finished
```

---

**Unicode block type with parameters**

Test a Unicode block type with parameters.

```wasot
.émojis .. param
```

```yaml
- block-started:
    type: émojis
    level: 1
    args: ["param"]
- block-finished
```

---

**Quoted Unicode block type**

Test a quoted block type containing Unicode characters.

```wasot
."日本語 type"
```

```yaml
- block-started:
    type: "日本語 type"
    level: 1
- block-finished
```

---

**Empty heading with parameters**

Test an empty heading block with parameters.

```wasot
.# .. id=value
```

```yaml
- block-started:
    type: "#"
    level: 1
    kwargs:
      id: value
- block-finished
```

---

**Block with no inline text**

Test a block with no inline text content.

```wasot
.div
```

```yaml
- block-started:
    type: div
    level: 1
- block-finished
```

---

**Block with unquoted inline text**

Test a block with simple unquoted inline text.

```wasot
.div some text
```

```yaml
- block-started:
    type: div
    level: 1
    inline-text: "some text"
- block-finished
```

---

**Block with empty inline text before parameters**

Test a block with empty inline text followed by parameters.

```wasot
.div .. params
```

```yaml
- block-started:
    type: div
    level: 1
    args: ["params"]
- block-finished
```

---

**Block with whitespace-only inline text**

Test a block with whitespace-only inline text before parameters.

```wasot
.div    .. params
```

```yaml
- block-started:
    type: div
    level: 1
    inline-text: "   "
    args: ["params"]
- block-finished
```

---

**Block with quoted inline text**

Test a block with quoted inline text.

```wasot
.div "quoted text"
```

```yaml
- block-started:
    type: div
    level: 1
    inline-text: "quoted text"
- block-finished
```

---

**Inline text with quotes inside**

Test inline text containing quote characters.

```wasot
.div text with "quotes" inside
```

```yaml
- block-started:
    type: div
    level: 1
    inline-text: "text with \"quotes\" inside"
- block-finished
```

---

**Inline text quoted from start**

Test inline text that starts with a quote but doesn't close.

```wasot
.div "text from start
```

```yaml
- block-started:
    type: div
    level: 1
    inline-text: "\"text from start"
- block-finished
```

---

**Inline text with escaped quotes**

Test inline text with escaped quote characters.

```wasot
.div "text \"escaped\""
```

```yaml
- block-started:
    type: div
    level: 1
    inline-text: "text \"escaped\""
    inline-text-quoted: true
- block-finished
```

---

**Inline text with Unicode and emoji**

Test inline text containing Unicode characters and emoji.

```wasot
.div 日本語 👨‍👩‍👧‍👦
```

```yaml
- block-started:
    type: div
    level: 1
    inline-text: "日本語 👨‍👩‍👧‍👦"
- block-finished
```

---

**Inline text with dots triggers parameters**

Test inline text containing dots that triggers parameter parsing.

```wasot
.div text with .. dots
```

```yaml
- block-started:
    type: div
    level: 1
    inline-text: "text with "
    args: ["dots"]
- block-finished
```

---

**Block with inline text and no parameters**

Test a block with inline text but no parameter separator.

```wasot
.div text
```

```yaml
- block-started:
    type: div
    level: 1
    inline-text: text
- block-finished
```

---

**Block with parameters only**

Test a block with only parameters and no inline text.

```wasot
.div .. params
```

```yaml
- block-started:
    type: div
    level: 1
    args: ["params"]
- block-finished
```

---

**Parameter separator inside quotes**

Test a block where the parameter separator appears inside quoted inline text.

```wasot
.div "text .. with dots" .. params
```

```yaml
- block-started:
    type: div
    level: 1
    inline-text: "text .. with dots"
    inline-text-quoted: true
    args: ["params"]
- block-finished
```

---

**Quoted positional arguments**

Test a block with quoted positional arguments containing spaces.

```wasot
.div .. "arg with spaces"
```

```yaml
- block-started:
    type: div
    level: 1
    args: ["arg with spaces"]
- block-finished
```

---

**Mixed quoted and unquoted arguments**

Test a block with a mixture of quoted and unquoted positional arguments.

```wasot
.div .. arg1 "arg 2" arg3
```

```yaml
- block-started:
    type: div
    level: 1
    args: ["arg1", "arg 2", "arg3"]
- block-finished
```

---

**Empty quoted positional argument**

Test a block with an empty string as a positional argument.

```wasot
.div .. ""
```

```yaml
- block-started:
    type: div
    level: 1
    args: [""]
- block-finished
```

---

**Argument with equals but no value**

Test a block with an argument that has equals but no value (becomes keyword).

```wasot
.div .. arg=
```

```yaml
- block-started:
    type: div
    level: 1
    kwargs:
      arg: ""
- block-finished
```

---

**Keyword argument with empty value**

Test a block with a keyword argument that has an empty quoted value.

```wasot
.div .. key=""
```

```yaml
- block-started:
    type: div
    level: 1
    kwargs:
      key: ""
- block-finished
```

---

**Basic keyword argument**

Test a block with a simple keyword argument.

```wasot
.div .. key=value
```

```yaml
- block-started:
    type: div
    level: 1
    kwargs:
      key: value
- block-finished
```

---

**Block with simple ID**

Test a block with a simple ID assignment.

```wasot
.div :my-id
```

```yaml
- block-started:
    type: div
    level: 1
    id: "my-id"
- block-finished
```

---

**ID placement with inline text**

Test a block with both an ID and inline text.

```wasot
.div inline text :my-id
```

```yaml
- block-started:
    type: div
    level: 1
    id: "my-id"
    inline-text: "inline text"
- block-finished
```

---

**ID placement with parameters**

Test a block with both an ID and parameters.

```wasot
.div .. param=value :my-id
```

```yaml
- block-started:
    type: div
    level: 1
    id: "my-id"
    kwargs:
      param: value
- block-finished
```

---

**ID with inline text and parameters**

Test a block with ID, inline text, and parameters.

```wasot
.div inline text .. param=value :my-id
```

```yaml
- block-started:
    type: div
    level: 1
    id: "my-id"
    inline-text: "inline text "
    kwargs:
      param: value
- block-finished
```

---

**Multiple IDs in line**

Test a block with multiple ID syntax elements (only last one used).

```wasot
.div :first-id inline text :second-id
```

```yaml
- block-started:
    type: div
    level: 1
    id: "second-id"
    inline-text: ":first-id inline text"
- block-finished
```

---

**ID with multiple colons**

Test an ID containing multiple colon separators.

```wasot
.div :namespace:sub:item
```

```yaml
- block-started:
    type: div
    level: 1
    id: "namespace:sub:item"
- block-finished
```

---

**ID containing numbers**

Test an ID containing numeric characters.

```wasot
.div :item-123
```

```yaml
- block-started:
    type: div
    level: 1
    id: "item-123"
- block-finished
```

---

**ID containing special characters**

Test an ID containing underscores and dashes.

```wasot
.div :item_special-chars
```

```yaml
- block-started:
    type: div
    level: 1
    id: "item_special-chars"
- block-finished
```

---

**Lone colon syntax**

Test a lone colon that doesn't form a valid ID.

```wasot
.div :
```

```yaml
- block-started:
    type: div
    level: 1
    inline-text: ":"
- block-finished
```

---

**ID with Unicode characters**

Test an ID containing Unicode characters.

```wasot
.div :café-résumé
```

```yaml
- block-started:
    type: div
    level: 1
    id: "café-résumé"
- block-finished
```

---

**Mixed Unicode ID**

Test an ID containing mixed Unicode, Latin, and numeric characters.

```wasot
.div :item日本語-123
```

```yaml
- block-started:
    type: div
    level: 1
    id: "item日本語-123"
- block-finished
```

---

**Text with empty lines**

Test text content containing empty lines.

```wasot
.div
First line of text.

Second line after empty line.
```

```yaml
- block-started:
    type: div
    level: 1
- text-finished:
    lines:
      - "First line of text."
      - ""
      - "Second line after empty line."
- block-finished
```

---

**Text content with indentation**

Test text content with various levels of indentation.

```wasot
.div
    Indented text line.
        More indented text.
    Back to first indent.
```

```yaml
- block-started:
    type: div
    level: 1
- text-finished:
    lines:
      - "    Indented text line."
      - "        More indented text."
      - "    Back to first indent."
- block-finished
```

---

**Text with trailing whitespace**

Test text content with trailing spaces and tabs.

```wasot
.div
Text with trailing spaces.   
More text with tabs.	
```

```yaml
- block-started:
    type: div
    level: 1
- text-finished:
    lines:
      - "Text with trailing spaces.   "
      - "More text with tabs.	"
- block-finished
```

---

**Parent with mixed text and child blocks**

Test a parent block containing both text content and child blocks.

```wasot
.parent
Parent text content.
..child
Child content.
More parent text.
```

```yaml
- block-started:
    type: parent
    level: 1
- text-finished:
    lines: ["Parent text content."]
- block-started:
    type: child
    level: 2
- text-finished:
    lines:
      - "Child content."
      - "More parent text."
- block-finished
- block-finished
```

---

**Non-adjacent text blocks**

Test text blocks separated by nested block elements.

```wasot
.parent
First text block.
..child
Child content.
Second text block.
```

```yaml
- block-started:
    type: parent
    level: 1
- text-finished:
    lines: ["First text block."]
- block-started:
    type: child
    level: 2
- text-finished:
    lines:
      - "Child content."
      - "Second text block."
- block-finished
- block-finished
```

---

**Sequential sibling blocks**

Test multiple sibling blocks at the same nesting level.

```wasot
.parent
..child1
First child.
..child2
Second child.
..child3
Third child.
```

```yaml
- block-started:
    type: parent
    level: 1
- block-started:
    type: child1
    level: 2
- text-finished:
    lines: ["First child."]
- block-finished
- block-started:
    type: child2
    level: 2
- text-finished:
    lines: ["Second child."]
- block-finished
- block-started:
    type: child3
    level: 2
- text-finished:
    lines: ["Third child."]
- block-finished
- block-finished
```

---

**Deep nesting with text at each level**

Test multiple levels of nesting with text content at each level.

```wasot
.level1
Level 1 text.
..level2
Level 2 text.
...level3
Level 3 text.
```

```yaml
- block-started:
    type: level1
    level: 1
- text-finished:
    lines: ["Level 1 text."]
- block-started:
    type: level2
    level: 2
- text-finished:
    lines: ["Level 2 text."]
- block-started:
    type: level3
    level: 3
- text-finished:
    lines: ["Level 3 text."]
- block-finished
- block-finished
- block-finished
```

---

**Parent block with only child content**

Test a parent block that contains only child blocks, no direct text.

```wasot
.parent
..child1
Child 1 content.
..child2
Child 2 content.
```

```yaml
- block-started:
    type: parent
    level: 1
- block-started:
    type: child1
    level: 2
- text-finished:
    lines: ["Child 1 content."]
- block-finished
- block-started:
    type: child2
    level: 2
- text-finished:
    lines: ["Child 2 content."]
- block-finished
- block-finished
```

---

**Block with all content types combined**

Test a block combining inline text, parameters, ID, text content, and child blocks.

```wasot
.container inline text .. param=value :my-id
Text content here.
..child
Child content.
```

```yaml
- block-started:
    type: container
    level: 1
    id: "my-id"
    inline-text: "inline text "
    kwargs:
      param: value
- text-finished:
    lines: ["Text content here."]
- block-started:
    type: child
    level: 2
- text-finished:
    lines: ["Child content."]
- block-finished
- block-finished
```

---

**Complex nested structure**

Test a complex tree structure with multiple branches and levels.

```wasot
.root
Root text.
..branch1
Branch 1 text.
...leaf1
Leaf content.
..branch2
...leaf2
Another leaf.
```

```yaml
- block-started:
    type: root
    level: 1
- text-finished:
    lines: ["Root text."]
- block-started:
    type: branch1
    level: 2
- text-finished:
    lines: ["Branch 1 text."]
- block-started:
    type: leaf1
    level: 3
- text-finished:
    lines: ["Leaf content."]
- block-finished
- block-finished
- block-started:
    type: branch2
    level: 2
- block-started:
    type: leaf2
    level: 3
- text-finished:
    lines: ["Another leaf."]
- block-finished
- block-finished
- block-finished
```

---

**Link with complex URL parameters**

Test a link containing URL parameters and special characters.

```wasot
.text
Visit ((https://example.com/path?param=value&other=123)) for details.
```

```yaml
- block-started:
    type: text
    level: 1
- text-finished:
    lines: ["Visit ((https://example.com/path?param=value&other=123)) for details."]
    links:
      - line: 0
        links:
          - name: "https://example.com/path?param=value&other=123"
            start: 6
            length: 50
- block-finished
```

---

**Link with special characters in display name**

Test a named link with quotes and symbols in the display text.

```wasot
.text
Click ((Name with "quotes" & symbols|https://example.com)) here.
```

```yaml
- block-started:
    type: text
    level: 1
- text-finished:
    lines: ["Click ((Name with \"quotes\" & symbols|https://example.com)) here."]
    links:
      - line: 0
        links:
          - name: "Name with \"quotes\" & symbols|https://example.com"
            start: 6
            length: 52
- block-finished
```

---

**Link URL with nested parentheses**

Test a link URL containing parentheses within the URL.

```wasot
.text
API call ((https://example.com/func(param))) available.
```

```yaml
- block-started:
    type: text
    level: 1
- text-finished:
    lines: ["API call ((https://example.com/func(param))) available."]
    links:
      - line: 0
        links:
          - name: "https://example.com/func(param"
            start: 9
            length: 34
- block-finished
```

---

**Link with pipe characters**

Test a link containing pipe characters.

```wasot
.text
Example ((Link|with|pipes|https://example.com)) text.
```

```yaml
- block-started:
    type: text
    level: 1
- text-finished:
    lines: ["Example ((Link|with|pipes|https://example.com)) text."]
    links:
      - line: 0
        links:
          - name: "Link|with|pipes|https://example.com"
            start: 8
            length: 39
- block-finished
```

---

**Multiple link types in one line**

Test combining URL, named, and ID reference links in one text.

```wasot
.text
Check ((https://docs.com)), see ((Main Page|https://main.com)), and go to ((:intro)) section.
```

```yaml
- block-started:
    type: text
    level: 1
- text-finished:
    lines: ["Check ((https://docs.com)), see ((Main Page|https://main.com)), and go to ((:intro)) section."]
    links:
      - line: 0
        links:
          - name: "https://docs.com"
            start: 6
            length: 20
          - name: "Main Page|https://main.com"
            start: 32
            length: 30
          - target: intro
            start: 74
            length: 10
- block-finished
```

---

**Links at text boundaries**

Test links positioned at the beginning and end of text.

```wasot
.text
((Start link)) in middle text ((end link)).
```

```yaml
- block-started:
    type: text
    level: 1
- text-finished:
    lines: ["((Start link)) in middle text ((end link))."]
    links:
      - line: 0
        links:
          - name: "Start link"
            start: 0
            length: 14
          - name: "end link"
            start: 30
            length: 12
- block-finished
```

---

**Basic footnote reference**

Test basic footnote syntax with reference and definition.

```wasot
.text
This is important text [1].
*1 See footnote for details.
```

```yaml
- block-started:
    type: text
    level: 1
- text-finished:
    lines:
      - "This is important text [1]."
      - "*1 See footnote for details."
    footnotes:
      - marker: 1
        link: "See footnote for details."
- block-finished
```

---

**Multiple footnotes with sequential numbering**

Test multiple footnotes with sequential numeric markers.

```wasot
.text
First [1], second [2], and third [3] items.
*1 First footnote
*2 Second footnote
*3 Third footnote
```

```yaml
- block-started:
    type: text
    level: 1
- text-finished:
    lines:
      - "First [1], second [2], and third [3] items."
      - "*1 First footnote"
      - "*2 Second footnote"
      - "*3 Third footnote"
    footnotes:
      - marker: 1
        link: "First footnote"
      - marker: 2
        link: "Second footnote"
      - marker: 3
        link: "Third footnote"
- block-finished
```

---

**Footnote containing links**

Test a footnote definition that contains link syntax.

```wasot
.text
Complex reference [1] here.
*1 See ((https://example.com)) for more info.
```

```yaml
- block-started:
    type: text
    level: 1
- text-finished:
    lines:
      - "Complex reference [1] here."
      - "*1 See ((https://example.com)) for more info."
    links:
      - line: 1
        links:
          - name: "https://example.com"
            start: 7
            length: 23
    footnotes:
      - marker: 1
        link: "See ((https://example.com)) for more info."
- block-finished
```

---

**Invalid footnote syntax**

Test text with invalid footnote references and malformed markers.

```wasot
.text
Invalid reference [invalid] and malformed *invalid marker.
```

```yaml
- block-started:
    type: text
    level: 1
- text-finished:
    lines: ["Invalid reference [invalid] and malformed *invalid marker."]
- block-finished
```

---

**Blog post with complex nesting**

Test a realistic blog post structure with deep nesting and metadata.

```wasot
.article :blog-post-123
..title .. class="main-heading"
Building Modern Web Applications
..meta .. published="2024-01-15" author="Jane Smith"
Published January 15, 2024 by Jane Smith
..abstract
This article explores the latest trends in web development, including modern frameworks, performance optimization, and user experience design patterns.
..section :introduction
...h2
Introduction
...p
Modern web development has evolved significantly over the past decade. This article will cover the essential concepts and tools needed to build performant, accessible web applications.
..section :frameworks
...h2
Framework Comparison
...subsection :react
....h3
React Ecosystem
....p
React continues to dominate the frontend landscape with its component-based architecture and extensive ecosystem.
....code-block .. language="javascript"
const App = () => {
  return <div>Hello World</div>;
};
...subsection :vue
....h3
Vue.js Features
....p
Vue.js offers a gentler learning curve while maintaining powerful features for complex applications.
..conclusion
In conclusion, the choice of framework depends on project requirements, team expertise, and long-term maintenance considerations.
```

```yaml
- block-started:
    type: article
    level: 1
    id: "blog-post-123"
- block-started:
    type: title
    level: 2
    kwargs:
      class: "main-heading"
- text-finished:
    lines: ["Building Modern Web Applications"]
- block-finished
- block-started:
    type: meta
    level: 2
    kwargs:
      published: "2024-01-15"
      author: "Jane Smith"
- text-finished:
    lines: ["Published January 15, 2024 by Jane Smith"]
- block-finished
- block-started:
    type: abstract
    level: 2
- text-finished:
    lines: ["This article explores the latest trends in web development, including modern frameworks, performance optimization, and user experience design patterns."]
- block-finished
- block-started:
    type: section
    level: 2
    id: introduction
- block-started:
    type: h2
    level: 3
- text-finished:
    lines: [Introduction]
- block-finished
- block-started:
    type: p
    level: 3
- text-finished:
    lines: ["Modern web development has evolved significantly over the past decade. This article will cover the essential concepts and tools needed to build performant, accessible web applications."]
- block-finished
- block-finished
- block-started:
    type: section
    level: 2
    id: frameworks
- block-started:
    type: h2
    level: 3
- text-finished:
    lines: ["Framework Comparison"]
- block-finished
- block-started:
    type: subsection
    level: 3
    id: react
- block-started:
    type: h3
    level: 4
- text-finished:
    lines: ["React Ecosystem"]
- block-finished
- block-started:
    type: p
    level: 4
- text-finished:
    lines: ["React continues to dominate the frontend landscape with its component-based architecture and extensive ecosystem."]
- block-finished
- block-started:
    type: "code-block"
    level: 4
    kwargs:
      language: javascript
- text-finished:
    lines:
      - "const App = () => {"
      - "  return <div>Hello World</div>;"
      - "};"
- block-finished
- block-finished
- block-started:
    type: subsection
    level: 3
    id: vue
- block-started:
    type: h3
    level: 4
- text-finished:
    lines: ["Vue.js Features"]
- block-finished
- block-started:
    type: p
    level: 4
- text-finished:
    lines: ["Vue.js offers a gentler learning curve while maintaining powerful features for complex applications."]
- block-finished
- block-finished
- block-finished
- block-started:
    type: conclusion
    level: 2
- text-finished:
    lines: ["In conclusion, the choice of framework depends on project requirements, team expertise, and long-term maintenance considerations."]
- block-finished
- block-finished
```

---

**API documentation with nested structures**

Test API documentation with complex nested parameter and response structures.

```wasot
.api-documentation .. version="2.1" format="openapi"
..endpoint .. method="POST" path="/api/users" :create-user
...description
Create a new user account with the provided information.
...request
....headers
.....header .. name="Content-Type" required=true
application/json
.....header .. name="Authorization" required=false
Bearer token (optional for public registration)
....body .. schema="UserCreateRequest"
.....field .. name="email" type="string" required=true
User's email address
.....field .. name="password" type="string" required=true minLength=8
User's password (minimum 8 characters)
.....field .. name="profile" type="object" required=false
.......field .. name="firstName" type="string"
.......field .. name="lastName" type="string"
...response .. status=201
....body .. schema="UserResponse"
.....field .. name="id" type="string"
Unique user identifier
.....field .. name="email" type="string"
.....field .. name="createdAt" type="timestamp"
...response .. status=400
....body .. schema="ErrorResponse"
.....field .. name="error" type="string"
.....field .. name="details" type="array"
..endpoint .. method="GET" path="/api/users/{id}" :get-user
...parameter .. name="id" location="path" type="string" required=true
User identifier
```

```yaml
- block-started:
    type: "api-documentation"
    level: 1
    kwargs:
      version: "2.1"
      format: openapi
- block-started:
    type: endpoint
    level: 2
    id: "create-user"
    kwargs:
      method: POST
      path: /api/users
- block-started:
    type: description
    level: 3
- text-finished:
    lines: ["Create a new user account with the provided information."]
- block-finished
- block-started:
    type: request
    level: 3
- block-started:
    type: headers
    level: 4
- block-started:
    type: header
    level: 5
    kwargs:
      name: "Content-Type"
      required: "true"
- text-finished:
    lines: [application/json]
- block-finished
- block-started:
    type: header
    level: 5
    kwargs:
      name: Authorization
      required: "false"
- text-finished:
    lines: ["Bearer token (optional for public registration)"]
- block-finished
- block-finished
- block-started:
    type: body
    level: 4
    kwargs:
      schema: UserCreateRequest
- block-started:
    type: field
    level: 5
    kwargs:
      name: email
      type: string
      required: "true"
- text-finished:
    lines: ["User's email address"]
- block-finished
- block-started:
    type: field
    level: 5
    kwargs:
      name: password
      type: string
      required: "true"
      minLength: "8"
- text-finished:
    lines: ["User's password (minimum 8 characters)"]
- block-finished
- block-started:
    type: field
    level: 5
    kwargs:
      name: profile
      type: object
      required: "false"
- block-started:
    type: field
    level: 7
    kwargs:
      name: firstName
      type: string
- block-finished
- block-started:
    type: field
    level: 7
    kwargs:
      name: lastName
      type: string
- block-finished
- block-finished
- block-finished
- block-finished
- block-started:
    type: response
    level: 3
    kwargs:
      status: "201"
- block-started:
    type: body
    level: 4
    kwargs:
      schema: UserResponse
- block-started:
    type: field
    level: 5
    kwargs:
      name: id
      type: string
- text-finished:
    lines: ["Unique user identifier"]
- block-finished
- block-started:
    type: field
    level: 5
    kwargs:
      name: email
      type: string
- block-finished
- block-started:
    type: field
    level: 5
    kwargs:
      name: createdAt
      type: timestamp
- block-finished
- block-finished
- block-finished
- block-started:
    type: response
    level: 3
    kwargs:
      status: "400"
- block-started:
    type: body
    level: 4
    kwargs:
      schema: ErrorResponse
- block-started:
    type: field
    level: 5
    kwargs:
      name: error
      type: string
- block-finished
- block-started:
    type: field
    level: 5
    kwargs:
      name: details
      type: array
- block-finished
- block-finished
- block-finished
- block-finished
- block-started:
    type: endpoint
    level: 2
    id: "get-user"
    kwargs:
      method: GET
      path: /api/users/{id}
- block-started:
    type: parameter
    level: 3
    kwargs:
      name: id
      location: path
      type: string
      required: "true"
- text-finished:
    lines: ["User identifier"]
- block-finished
- block-finished
- block-finished
```

---

**Configuration file with hierarchical settings**

Test a complex configuration file structure with nested settings and environment variables.

```wasot
.configuration .. env="production" version="1.0"
..database
...connection .. driver="postgresql" pool=true
....host .. value="db.example.com" env="DB_HOST"
....port .. value=5432 env="DB_PORT"
....database .. value="myapp_prod" env="DB_NAME"
....credentials
.....username .. value="app_user" env="DB_USER"
.....password .. value="***" env="DB_PASSWORD" encrypted=true
....pool-settings
.....min-connections .. value=5
.....max-connections .. value=20
.....idle-timeout .. value=30000 unit="ms"
..cache
...redis
....host .. value="cache.example.com" env="REDIS_HOST"
....port .. value=6379 env="REDIS_PORT"
....database .. value=0
....ttl .. value=3600 unit="seconds"
..logging
...level .. value="info" env="LOG_LEVEL"
...destinations
....console .. enabled=true format="json"
....file .. enabled=true path="/var/log/app.log" rotation="daily"
....syslog .. enabled=false facility="local0"
..features .. experimental=false
...feature-flags
....new-ui .. enabled=false percentage=10
....advanced-search .. enabled=true
....beta-api .. enabled=false whitelist="admin,tester"
```

```yaml
- block-started:
    type: configuration
    level: 1
    kwargs:
      env: production
      version: "1.0"
- block-started:
    type: database
    level: 2
- block-started:
    type: connection
    level: 3
    kwargs:
      driver: postgresql
      pool: "true"
- block-started:
    type: host
    level: 4
    kwargs:
      value: db.example.com
      env: DB_HOST
- block-finished
- block-started:
    type: port
    level: 4
    kwargs:
      value: "5432"
      env: DB_PORT
- block-finished
- block-started:
    type: database
    level: 4
    kwargs:
      value: myapp_prod
      env: DB_NAME
- block-finished
- block-started:
    type: credentials
    level: 4
- block-started:
    type: username
    level: 5
    kwargs:
      value: app_user
      env: DB_USER
- block-finished
- block-started:
    type: password
    level: 5
    kwargs:
      value: "***"
      env: DB_PASSWORD
      encrypted: "true"
- block-finished
- block-finished
- block-started:
    type: "pool-settings"
    level: 4
- block-started:
    type: "min-connections"
    level: 5
    kwargs:
      value: "5"
- block-finished
- block-started:
    type: "max-connections"
    level: 5
    kwargs:
      value: "20"
- block-finished
- block-started:
    type: "idle-timeout"
    level: 5
    kwargs:
      value: "30000"
      unit: ms
- block-finished
- block-finished
- block-finished
- block-finished
- block-started:
    type: cache
    level: 2
- block-started:
    type: redis
    level: 3
- block-started:
    type: host
    level: 4
    kwargs:
      value: cache.example.com
      env: REDIS_HOST
- block-finished
- block-started:
    type: port
    level: 4
    kwargs:
      value: "6379"
      env: REDIS_PORT
- block-finished
- block-started:
    type: database
    level: 4
    kwargs:
      value: "0"
- block-finished
- block-started:
    type: ttl
    level: 4
    kwargs:
      value: "3600"
      unit: seconds
- block-finished
- block-finished
- block-finished
- block-started:
    type: logging
    level: 2
- block-started:
    type: level
    level: 3
    kwargs:
      value: info
      env: LOG_LEVEL
- block-finished
- block-started:
    type: destinations
    level: 3
- block-started:
    type: console
    level: 4
    kwargs:
      enabled: "true"
      format: json
- block-finished
- block-started:
    type: file
    level: 4
    kwargs:
      enabled: "true"
      path: /var/log/app.log
      rotation: daily
- block-finished
- block-started:
    type: syslog
    level: 4
    kwargs:
      enabled: "false"
      facility: local0
- block-finished
- block-finished
- block-finished
- block-started:
    type: features
    level: 2
    kwargs:
      experimental: "false"
- block-started:
    type: "feature-flags"
    level: 3
- block-started:
    type: "new-ui"
    level: 4
    kwargs:
      enabled: "false"
      percentage: "10"
- block-finished
- block-started:
    type: "advanced-search"
    level: 4
    kwargs:
      enabled: "true"
- block-finished
- block-started:
    type: "beta-api"
    level: 4
    kwargs:
      enabled: "false"
      whitelist: admin,tester
- block-finished
- block-finished
- block-finished
- block-finished
```

---

**Multi-language content with Unicode**

Test content in multiple languages with proper Unicode handling.

```wasot
.document .. lang="multi" encoding="utf-8"
..section .. lang="en" :english-content
...title
Welcome to Our International Service
...content
This platform supports multiple languages and international users from around the world.
..section .. lang="es" :spanish-content
...title
Bienvenido a Nuestro Servicio Internacional
...content
Esta plataforma admite múltiples idiomas y usuarios internacionales de todo el mundo.
..section .. lang="ja" :japanese-content
...title
国際サービスへようこそ
...content
このプラットフォームは、世界中の複数の言語と国際的なユーザーをサポートしています。
..section .. lang="ar" dir="rtl" :arabic-content
...title
مرحباً بكم في خدمتنا الدولية
...content
تدعم هذه المنصة لغات متعددة ومستخدمين دوليين من جميع أنحاء العالم.
..section .. lang="zh" :chinese-content
...title
欢迎使用我们的国际服务
...content
该平台支持多种语言和来自世界各地的国际用户。
..section .. lang="hi" :hindi-content
...title
हमारी अंतर्राष्ट्रीय सेवा में आपका स्वागत है
...content
यह प्लेटफॉर्म दुनिया भर की कई भाषाओं और अंतर्राष्ट्रीय उपयोगकर्ताओं का समर्थन करता है।
```

```yaml
- block-started:
    type: document
    level: 1
    kwargs:
      lang: multi
      encoding: "utf-8"
- block-started:
    type: section
    level: 2
    id: "english-content"
    kwargs:
      lang: en
- block-started:
    type: title
    level: 3
- text-finished:
    lines: ["Welcome to Our International Service"]
- block-finished
- block-started:
    type: content
    level: 3
- text-finished:
    lines: ["This platform supports multiple languages and international users from around the world."]
- block-finished
- block-finished
- block-started:
    type: section
    level: 2
    id: "spanish-content"
    kwargs:
      lang: es
- block-started:
    type: title
    level: 3
- text-finished:
    lines: ["Bienvenido a Nuestro Servicio Internacional"]
- block-finished
- block-started:
    type: content
    level: 3
- text-finished:
    lines: ["Esta plataforma admite múltiples idiomas y usuarios internacionales de todo el mundo."]
- block-finished
- block-finished
- block-started:
    type: section
    level: 2
    id: "japanese-content"
    kwargs:
      lang: ja
- block-started:
    type: title
    level: 3
- text-finished:
    lines: [国際サービスへようこそ]
- block-finished
- block-started:
    type: content
    level: 3
- text-finished:
    lines: [このプラットフォームは、世界中の複数の言語と国際的なユーザーをサポートしています。]
- block-finished
- block-finished
- block-started:
    type: section
    level: 2
    id: "arabic-content"
    kwargs:
      lang: ar
      dir: rtl
- block-started:
    type: title
    level: 3
- text-finished:
    lines: ["مرحباً بكم في خدمتنا الدولية"]
- block-finished
- block-started:
    type: content
    level: 3
- text-finished:
    lines: ["تدعم هذه المنصة لغات متعددة ومستخدمين دوليين من جميع أنحاء العالم."]
- block-finished
- block-finished
- block-started:
    type: section
    level: 2
    id: "chinese-content"
    kwargs:
      lang: zh
- block-started:
    type: title
    level: 3
- text-finished:
    lines: [欢迎使用我们的国际服务]
- block-finished
- block-started:
    type: content
    level: 3
- text-finished:
    lines: [该平台支持多种语言和来自世界各地的国际用户。]
- block-finished
- block-finished
- block-started:
    type: section
    level: 2
    id: "hindi-content"
    kwargs:
      lang: hi
- block-started:
    type: title
    level: 3
- text-finished:
    lines: ["हमारी अंतर्राष्ट्रीय सेवा में आपका स्वागत है"]
- block-finished
- block-started:
    type: content
    level: 3
- text-finished:
    lines: ["यह प्लेटफॉर्म दुनिया भर की कई भाषाओं और अंतर्राष्ट्रीय उपयोगकर्ताओं का समर्थन करता है।"]
- block-finished
- block-finished
- block-finished
```
---

**Simple context line**

Test a basic context line at level 1.

```wasot
.block
./metadata
Some content
```

```yaml
- block-started:
    type: block
    level: 1
- context-line:
    type: metadata
    level: 1
- text-finished:
    lines: ["Some content"]
- block-finished
```

---

**Context line with inline text**

Test a context line with inline text content.

```wasot
.block
./author John Doe
Some content
```

```yaml
- block-started:
    type: block
    level: 1
- context-line:
    type: author
    level: 1
    inline-text: "John Doe"
- text-finished:
    lines: ["Some content"]
- block-finished
```

---

**Nested context line**

Test a context line at level 2 inside a nested block.

```wasot
.outer
..inner
../version 1.0
Content here
```

```yaml
- block-started:
    type: outer
    level: 1
- block-started:
    type: inner
    level: 2
- context-line:
    type: version
    level: 2
    inline-text: "1.0"
- text-finished:
    lines: ["Content here"]
- block-finished
- block-finished
```

---

**Multiple context lines**

Test multiple context lines in sequence.

```wasot
.document
./author Alice
./date 2024-01-15
./version 1.0
Document content here.
```

```yaml
- block-started:
    type: document
    level: 1
- context-line:
    type: author
    level: 1
    inline-text: "Alice"
- context-line:
    type: date
    level: 1
    inline-text: "2024-01-15"
- context-line:
    type: version
    level: 1
    inline-text: "1.0"
- text-finished:
    lines: ["Document content here."]
- block-finished
```

---

**Context line with ID**

Test a context line with an explicit ID.

```wasot
.block
./meta :my-metadata
Content
```

```yaml
- block-started:
    type: block
    level: 1
- context-line:
    type: meta
    level: 1
    id: "my-metadata"
- text-finished:
    lines: ["Content"]
- block-finished
```

---

**Context line does not affect block structure**

Test that context lines don't close or open blocks.

```wasot
.outer
..inner
../contextinfo
More nested content
..another
Content in another
```

```yaml
- block-started:
    type: outer
    level: 1
- block-started:
    type: inner
    level: 2
- context-line:
    type: contextinfo
    level: 2
- text-finished:
    lines: ["More nested content"]
- block-finished
- block-started:
    type: another
    level: 2
- text-finished:
    lines: ["Content in another"]
- block-finished
- block-finished
```

---

## Void Elements

Void elements are self-closing elements that cannot have content. They are marked with a trailing colon (`:`) after the type name.

---

**Basic void element**

Test a simple void element with no additional content.

```wasot
.hr:
```

```yaml
- void-element:
    type: hr
    level: 1
```

---

**Void element with inline text**

Test a void element that has inline text.

```wasot
.img: A beautiful sunset
```

```yaml
- void-element:
    type: img
    inline-text: "A beautiful sunset"
```

---

**Void element with arguments**

Test a void element with keyword arguments after the double-dot separator.

```wasot
.img: alt text here .. src="photo.jpg"
```

```yaml
- void-element:
    type: img
    level: 1
    inline-text: "alt text here "
    kwargs:
      src: "photo.jpg"
```

---

**Void element with ID**

Test a void element with an ID specified.

```wasot
.timestamp: 2024-01-15 :ts1
```

```yaml
- void-element:
    type: timestamp
    level: 1
    inline-text: "2024-01-15"
    id: ts1
```

---

**Void element with arguments and ID**

Test a void element with both arguments and an ID.

```wasot
.img: alt text .. src="sunset.jpg" alt="Sunset" :fig1
```

```yaml
- void-element:
    type: img
    level: 1
    inline-text: "alt text "
    kwargs:
      src: "sunset.jpg"
      alt: "Sunset"
    id: fig1
```

---

**Nested void element**

Test a void element at a deeper nesting level.

```wasot
..nested-void:
```

```yaml
- void-element:
    type: nested-void
    level: 2
```

---

**Deeply nested void element**

Test a void element at level 3.

```wasot
...deep-void: with text
```

```yaml
- void-element:
    type: deep-void
    level: 3
    inline-text: "with text"
```

---

**Void element with quoted type name**

Test a void element where the type name contains spaces.

```wasot
."page break":
```

```yaml
- void-element:
    type: "page break"
    level: 1
```

---

**Void element with quoted type and inline text**

Test a void element with quoted type name and inline text.

```wasot
."section divider": ~~~
```

```yaml
- void-element:
    type: "section divider"
    level: 1
    inline-text: "~~~"
```

---

**Void element does not affect block nesting**

Test that a void element inside a block doesn't close or modify the parent block structure.

```wasot
.document
This is inside the document.
..hr:
Still inside the document.
./
```

```yaml
- block-started:
    type: document
    level: 1
- text-finished:
    lines: ["This is inside the document."]
- void-element:
    type: hr
    level: 2
- text-finished:
    lines: ["Still inside the document."]
- block-finished
```

---

**Multiple void elements in sequence**

Test multiple void elements one after another.

```wasot
.br:
.hr:
.br:
```

```yaml
- void-element:
    type: br
    level: 1
- void-element:
    type: hr
    level: 1
- void-element:
    type: br
    level: 1
```

---

**Void element between nested blocks**

Test void elements interspersed with regular nested blocks.

```wasot
.article
Opening paragraph.
..section
Section content.
..hr:
..another-section
More content.
./
```

```yaml
- block-started:
    type: article
    level: 1
- text-finished:
    lines: ["Opening paragraph."]
- block-started:
    type: section
    level: 2
- text-finished:
    lines: ["Section content."]
- block-finished
- void-element:
    type: hr
    level: 2
- block-started:
    type: another-section
    level: 2
- text-finished:
    lines: ["More content."]
- block-finished
- block-finished
```

---

**Void heading using .# syntax**

Test that self-closing headings can also be void.

```wasot
.#: Introduction
```

```yaml
- void-element:
    type: "#"
    level: 1
    inline-text: "Introduction"
```

---

**Void element with empty inline text**

Test a void element with no inline text.

```wasot
.marker:
```

```yaml
- void-element:
    type: marker
    level: 1
```

---

**Void element inside deeply nested structure**

Test void elements at various levels within a nested structure.

```wasot
.document
..chapter
...section
....hr:
...paragraph
Content here.
```

```yaml
- block-started:
    type: document
    level: 1
- block-started:
    type: chapter
    level: 2
- block-started:
    type: section
    level: 3
- void-element:
    type: hr
    level: 4
- block-finished
- block-started:
    type: paragraph
    level: 3
- text-finished:
    lines: ["Content here."]
- block-finished
- block-finished
- block-finished
```

---

**Void element with complex arguments**

Test a void element with multiple keyword arguments including quoted values.

```wasot
.embed: .. type="video" src="https://example.com/video.mp4" autoplay="true" width="640" height="480"
```

```yaml
- void-element:
    type: embed
    level: 1
    kwargs:
      type: "video"
      src: "https://example.com/video.mp4"
      autoplay: "true"
      width: "640"
      height: "480"
```

---

**Mixed void and regular blocks at same level**

Test alternating between void and regular blocks at the same nesting level.

```wasot
.intro
Welcome text.
./
.hr:
.content
Main content.
./
.hr:
.footer
Footer text.
./
```

```yaml
- block-started:
    type: intro
    level: 1
- text-finished:
    lines: ["Welcome text."]
- block-finished
- void-element:
    type: hr
    level: 1
- block-started:
    type: content
    level: 1
- text-finished:
    lines: ["Main content."]
- block-finished
- void-element:
    type: hr
    level: 1
- block-started:
    type: footer
    level: 1
- text-finished:
    lines: ["Footer text."]
- block-finished
```
