# URL Handling

> Editor42 URL handling options — whether links and images keep relative or absolute URLs, the base URL they resolve against, and a URL converter of your own.

Source: https://editor42.com/api/configuration/url-handling  
Section: Configuration Options > URL Handling  
Every page of editor42.com has a Markdown copy at its URL + `.md` (`index.md` after a URL that ends in `/`); all of them are in one file: https://editor42.com/llms-full.txt

These options control how the editor converts and processes URLs in content, including whether they are stored as relative or absolute paths.

## Options

| Option | Type | Default | Description |
|---|---|---|---|
| `convert_urls` | boolean | `true` | Convert URLs to relative or absolute form when content is set or inserted. Set to `false` to leave URLs exactly as entered. |
| `relative_urls` | boolean | `true` | Convert URLs to relative paths based on `document_base_url`. When `false`, URLs are converted to absolute form instead. Only applies when `convert_urls` is `true`. |
| `remove_script_host` | boolean | `true` | Remove the protocol and hostname from URLs when converting to relative form, producing paths like `/images/logo.png` instead of `https://example.com/images/logo.png`. |
| `document_base_url` | string | — | Base URL used for relative URL resolution. Defaults to the directory of the current page. |
| `url_converter` | function | — | Custom function that converts URLs. Receives the URL, the attribute name, and the element tag. Must return the converted URL string. |
| `url_converter_scope` | object | — | Object used as `this` scope when calling the `url_converter` function. |
| `urlconverter_callback` | function | — | Callback invoked during URL conversion. |
| `typeahead_urls` | boolean | `true` | Enable URL autocompletion in link and image dialogs. |

## Example

```js
editor42.init({
  selector: 'textarea',
  convert_urls: true,
  relative_urls: false,
  remove_script_host: false,
  document_base_url: 'https://example.com/content/',
  url_converter: (url, name, tag) => {
    // Custom URL conversion logic
    return url;
  }
});
```
