> ## Documentation Index
> Fetch the complete documentation index at: https://fxscripts.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Shared exports

> Helpers available on both client and server contexts.

Same call signature on client or server.

## `formatMessage(args)`

Apply fxChat's color-code and markdown parser to a string. Returns the
HTML that fxChat would render.

```lua Shared theme={null}
local html = exports.fxChat:formatMessage('Hello {#ec4899}world{/}!')
```

<ParamField path="args" type="string" required>
  Raw input with optional inline color codes and markdown.
</ParamField>

<ParamField path="returns" type="string">
  Sanitized HTML. Already escaped — safe to pass through to NUI directly.
</ParamField>

```lua Example theme={null}
local rendered = exports.fxChat:formatMessage('**bold** ^4blue^0 normal')
print(rendered)
-- → <strong>bold</strong> <span style="color:#0000ff">blue</span> normal
```

<Tip>
  Useful for mimicking fxChat's rendering in your own NUI.
</Tip>

***

## `getConfig(key?)`

Read a value from `configs/chat.lua` from either side. Returns the entire
config table when called without arguments.

```lua Shared theme={null}
local rateLimit = exports.fxChat:getConfig('RateLimit')
local entire = exports.fxChat:getConfig()
```

<ParamField path="key" type="string">
  Top-level config key. Omit to get the full table.
</ParamField>

<ParamField path="returns" type="any">
  The config value. `nil` if the key doesn't exist.
</ParamField>

```lua Example theme={null}
-- Adapt your own behavior to match fxChat's rate limit
local rate = exports.fxChat:getConfig('RateLimit')
print(('Chat allows %d messages per %dms'):format(rate.messages, rate.window))
```

***

## `getThemeNames()`

List the theme filenames installed on the server.

```lua Shared theme={null}
local themes = exports.fxChat:getThemeNames()
```

<ParamField path="returns" type="string[]">
  e.g. `{ "default", "midnight", "crimson", "glass", "catppuccin", "samp", "ghostty" }`
</ParamField>

```lua Example theme={null}
local available = exports.fxChat:getThemeNames()
print('Themes:', table.concat(available, ', '))
```

***

## `getVersion()`

Returns the fxChat version string from `fxmanifest.lua`.

```lua Shared theme={null}
local version = exports.fxChat:getVersion()
```

<ParamField path="returns" type="string">
  e.g. `"2.0.0"`.
</ParamField>

```lua Example theme={null}
if exports.fxChat:getVersion() < '2.0.0' then
    print('Older fxChat — some features may be missing')
end
```

***

<Note>
  Don't make security decisions based on client-side `getConfig` — the
  server source is the only trusted one.
</Note>
