返回 slidev
monaco-write.md
根目录 / docs / features / monaco-write.md
1 ---
2 depends:
3 - features/monaco-editor
4 - features/import-snippet
5 relates:
6 - features/import-snippet
7 - Custom Code Runners: /custom/config-code-runners
8 since: v0.49.5
9 tags: [codeblock, editor]
10 description: |
11 A monaco editor that allows you to write code directly in the slides and save the changes back to the file.
12 ---
13
14 # Writable Monaco Editor
15
16 You can also use the [Import Code Snippets](#import-code-snippets) syntax combined with the `{monaco-write}` directive, to link your Monaco Editor with a file on your filesystem. This will allow you to edit the code directly in the editor and save the changes back to the file.
17
18 ```md
19 <<< ./some-file.ts {monaco-write}
20 ```
21
22 When using this, be sure to back up your files beforehand, as the changes will be saved directly to the file.
23
23 lines MARKDOWN