Skip to content

Commit 4b8e2bb

Browse files
authored
docs: add monaco editorOptions (#142)
1 parent 6e0af1f commit 4b8e2bb

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

custom/config-monaco.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,3 +108,30 @@ export default defineMonacoSetup((monaco) => {
108108
```
109109

110110
> If you are creating a theme for Slidev, use dynamic `import()` inside the setup function to get better tree-shaking and code-splitting results.
111+
112+
## Configure the Editor
113+
114+
> Available since v0.43.0
115+
116+
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.
117+
118+
~~~ts
119+
//```ts {monaco} { editorOptions: { wordWrap:'on'} }
120+
console.log('HelloWorld')
121+
//```
122+
~~~
123+
124+
Alternatively if you would like these options to be applied to every Monaco instance, you can return them in the `defineMonacoSetup` function
125+
126+
```ts
127+
// ./setup/monaco.ts
128+
import { defineMonacoSetup } from '@slidev/types'
129+
130+
export default defineMonacoSetup(() => {
131+
return {
132+
editorOptions: {
133+
wordWrap: 'on'
134+
}
135+
}
136+
})
137+
```

0 commit comments

Comments
 (0)