# `SnakeBridge.Docs.RstParser`
[🔗](https://github.com/nshkrdotcom/snakebridge/blob/v0.16.0/lib/snakebridge/docs/rst_parser.ex#L1)

Parses Python docstrings in various formats (Google, NumPy, Sphinx, Epytext).

This module detects the docstring format and extracts structured information
including parameters, return values, exceptions, and examples.

## Supported Formats

- **Google style**: Uses `Args:`, `Returns:`, `Raises:` sections
- **NumPy style**: Uses underlined section headers (`Parameters
----------`)
- **Sphinx/reST style**: Uses `:param:`, `:type:`, `:returns:` directives
- **Epytext style**: Uses `@param`, `@type`, `@return` tags

# `param`

```elixir
@type param() :: %{
  name: String.t(),
  type_name: String.t() | nil,
  description: String.t() | nil,
  optional: boolean(),
  default: String.t() | nil
}
```

# `parsed_doc`

```elixir
@type parsed_doc() :: %{
  short_description: String.t() | nil,
  long_description: String.t() | nil,
  params: [param()],
  returns: returns() | nil,
  raises: [raises()],
  examples: [String.t()],
  notes: String.t() | nil,
  style: atom()
}
```

# `raises`

```elixir
@type raises() :: %{type_name: String.t(), description: String.t() | nil}
```

# `returns`

```elixir
@type returns() :: %{type_name: String.t() | nil, description: String.t() | nil}
```

# `detect_style`

```elixir
@spec detect_style(String.t() | nil) :: atom()
```

Detects the docstring style based on content patterns.

# `parse`

```elixir
@spec parse(String.t() | nil) :: parsed_doc()
```

Parses a Python docstring and returns structured data.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
