Diffdown is a real-time collaborative Markdown editor/previewer built on the AT Protocol diffdown.com
1# @codemirror/view [![NPM version](https://img.shields.io/npm/v/@codemirror/view.svg)](https://www.npmjs.org/package/@codemirror/view) 2 3[ [**WEBSITE**](https://codemirror.net/) | [**DOCS**](https://codemirror.net/docs/ref/#view) | [**ISSUES**](https://github.com/codemirror/dev/issues) | [**FORUM**](https://discuss.codemirror.net/c/next/) | [**CHANGELOG**](https://github.com/codemirror/view/blob/main/CHANGELOG.md) ] 4 5This package implements the DOM view component for the 6[CodeMirror](https://codemirror.net/) code editor. 7 8The [project page](https://codemirror.net/) has more information, a 9number of [examples](https://codemirror.net/examples/) and the 10[documentation](https://codemirror.net/docs/). 11 12This code is released under an 13[MIT license](https://github.com/codemirror/view/tree/main/LICENSE). 14 15We aim to be an inclusive, welcoming community. To make that explicit, 16we have a [code of 17conduct](http://contributor-covenant.org/version/1/1/0/) that applies 18to communication around the project. 19 20## Usage 21 22```javascript 23import {EditorView} from "@codemirror/view" 24import {basicSetup} from "codemirror" 25 26const view = new EditorView({ 27 parent: document.querySelector("#some-node"), 28 doc: "Content text", 29 extensions: [basicSetup /* ... */] 30}) 31``` 32 33Add additional extensions, such as a [language 34mode](https://codemirror.net/#languages), to configure the editor. 35Call 36[`view.dispatch`](https://codemirror.net/docs/ref/#view.EditorView.dispatch) 37to update the editor's state.