# orca.ui.code

> A module of morca's API.

`/code?u=`: a file at a commit on GitHub, its lines coloured as HTML (`orca.highlight`), for the code shown on hover; the UI fetches it, so a browser needn't reach GitHub.

## Functions

### `raw_code_url`

```mojo
def raw_code_url(href: String) -> String
```

`https://raw.githubusercontent.com/<o>/<r>/<sha>/<path>` for a link to a file at a commit on GitHub (`https://github.com/<o>/<r>/blob/ <sha>/<path>`, as the UI's code links are, without `#L`), or "" for anything else, so `/code` fetches nothing but such files.

### `code_page`

```mojo
def code_page(href: String, at: String = "") -> Page
```

`/code?u=<a GitHub link to a file at a commit>`: the file's lines and each coloured as HTML (`orca.highlight`), as JSON, for the code shown on hover. 400 for any other URL, 502 when GitHub doesn't give it (a private repository), 413 past `_CODE_MAX`. With `at`, a line, only the signature of the `def` there and its docstring's first paragraph (`orca.ui.step_cards.def_json`), for a step's card; 400 for an `at` that isn't a line number.
