> ## Documentation Index
> Fetch the complete documentation index at: https://chart-spec.enchor.us/llms.txt
> Use this file to discover all available pages before exploring further.

# editSong

```ts theme={null}
const editSong: (song, edit) => SongDocument = editSongWithRawAdditions;
```

Applies a batch of edits to a song's chart and song.ini and returns the edited song, leaving `song` unchanged: the
earlier document is the undo step. Every byte the edits don't touch is kept, and an empty batch returns `song`.

Throws if an edit doesn't fit the chart's format, such as a length on a `.chart` text event.

## Parameters

| Parameter | Type |
| - | - |
| `song` | [`SongDocument`](https://chart-spec.enchor.us/scan-chart/api/index/interfaces/SongDocument) |
| `edit` | (`batch`) => `void` |

## Returns

[`SongDocument`](https://chart-spec.enchor.us/scan-chart/api/index/interfaces/SongDocument)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.