Skip to content
This repository was archived by the owner on May 19, 2025. It is now read-only.

Commit e7347d9

Browse files
committed
Rewrite README.md
1 parent 6889bca commit e7347d9

1 file changed

Lines changed: 59 additions & 17 deletions

File tree

README.md

Lines changed: 59 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,69 @@
1-
# CodeMirror element
1+
# <code-mirror>
22

3-
This package wraps the [CodeMirror text editor](http://codemirror.net) in a Polymer element.
3+
This Polymer element wraps the [CodeMirror text editor](http://codemirror.net).
44

5-
## Using elements
5+
## Demo
66

7-
Import into HTML:
7+
[Check it live!](http://dartlab.org/codemirror-element/simple_example.html)
88

9-
```html
10-
<link rel="import" href="packages/codemirror_element/codemirror.html">
9+
## Install
10+
11+
Add this to your package's `pubspec.yaml` file:
12+
13+
```yaml
14+
dependencies:
15+
codemirror_element: any
1116
```
1217
13-
Use `code-mirror` element:
18+
You can install packages from the command line:
1419
15-
```html
16-
<code-mirror value="{{value}}"
17-
mode="{{mode}}"
18-
theme="{{theme}}"
19-
lineNumbers="{{lineNumbers}}"
20-
indentWithTabs="{{indentWithTabs}}"
21-
autoCloseTags="{{autoCloseTags}}">
22-
</code-mirror>
20+
```sh
21+
$ pub get
2322
```
2423

25-
## Examples
24+
## Usage
25+
26+
1. Import Custom Element:
27+
28+
```html
29+
<link rel="import" href="packages/codemirror_element/codemirror.html">
30+
```
31+
32+
2. Start using it!
33+
34+
```html
35+
<code-mirror></code-mirror>
36+
```
37+
38+
## Options
39+
40+
Attribute | Options | Default | Description
41+
--- | --- | --- | ---
42+
`value` | *string* | | The value of the editor.
43+
`mode` | *string* | | The [mode](http://codemirror.net/mode/index.html) to use.
44+
`theme` | *string* | | The [theme](http://codemirror.net/theme/) to style the editor with.
45+
`lineNumbers` | *bool* | `false` | Whether to show line numbers to the left of the editor.
46+
`indentWithTabs`| *bool* | `false` | Whether, when indenting, the first N*tabSize spaces should be replaced by N tabs.
47+
`autoCloseTags` | *bool* | `false` | Defines an autoCloseTags option that will auto-close XML tags when '>' or '/' is typed.
48+
49+
## Methods
50+
51+
Method | Parameters | Returns | Description
52+
--- | --- | --- | ---
53+
`focus()` | None. | Nothing. | Give the editor focus.
54+
55+
## Contributing
56+
57+
1. Fork it!
58+
2. Create your feature branch: `git checkout -b my-new-feature`
59+
3. Commit your changes: `git commit -m 'Add some feature'`
60+
4. Push to the branch: `git push origin my-new-feature`
61+
5. Submit a pull request :D
62+
63+
## History
64+
65+
For detailed changelog, check [CHANGELOG](https://github.com/dartlab/codemirror-element/blob/master/CHANGELOG.md).
66+
67+
## License
2668

27-
Examples are located in `example` folder.
69+
[BSD license](https://github.com/dartlab/codemirror-element/blob/master/LICENSE)

0 commit comments

Comments
 (0)