Skip to content

Commit

Permalink
docs: add monaco editorOptions (#142)
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosingles authored Sep 4, 2023
1 parent 6e0af1f commit 4b8e2bb
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions custom/config-monaco.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,30 @@ export default defineMonacoSetup((monaco) => {
```

> If you are creating a theme for Slidev, use dynamic `import()` inside the setup function to get better tree-shaking and code-splitting results.
## Configure the Editor

> Available since v0.43.0
If you would like to customize the Monaco editor you may pass an `editorOptions` object that matches the [Monaco IEditorOptions](https://microsoft.github.io/monaco-editor/docs.html#interfaces/editor.IEditorOptions.html) definition.

~~~ts
//```ts {monaco} { editorOptions: { wordWrap:'on'} }
console.log('HelloWorld')
//```
~~~

Alternatively if you would like these options to be applied to every Monaco instance, you can return them in the `defineMonacoSetup` function

```ts
// ./setup/monaco.ts
import { defineMonacoSetup } from '@slidev/types'

export default defineMonacoSetup(() => {
return {
editorOptions: {
wordWrap: 'on'
}
}
})
```

0 comments on commit 4b8e2bb

Please sign in to comment.