2016-07-14 08:39:39 -07:00
# Examples
2016-07-14 16:35:48 -07:00
![](../docs/images/preview.png)
2016-07-14 08:39:39 -07:00
This directory contains a set of examples that give you an idea for how you might use Slate to implement your own editor. Take a look around!
- [**Plain text** ](./plain-text ) — showing the most basic case: a glorified `<textarea>` .
- [**Rich text** ](./rich-text ) — showing the features you'd expect from a basic editor.
2017-07-31 21:19:45 -04:00
- [**Forced Layout** ](./forced-layout ) - showing how to use schema rules to enforce document structure
2016-07-14 08:39:39 -07:00
- [**Auto-markdown** ](./auto-markdown ) — showing how to add key handlers for Markdown-like shortcuts.
- [**Links** ](./links ) — showing how wrap text in inline nodes with associated data.
- [**Images** ](./images ) — showing how to use void (text-less) nodes to add images.
- [**Hovering menu** ](./hovering-menu ) — showing how a contextual hovering menu can be implemented.
- [**Tables** ](./tables ) — showing how to nest blocks to render more advanced components.
- [**Paste HTML** ](./paste-html ) — showing how to use an HTML serializer to handle pasted HTML.
- [**Code Highlighting** ](./code-highlighting ) — showing how to use decorators to dynamically mark text.
2017-09-11 18:11:45 -07:00
- ...and more!
2016-07-14 08:39:39 -07:00
If you have an idea for an example that shows a common use case, pull request it!
## Running the Examples
2017-09-11 18:11:45 -07:00
To get the examples running on your machine, you need to have the Slate repository cloned to your computer. After that, you need to `cd` into the directory where you cloned it, and install the dependencies with `yarn` and bootstrap the monorepo:
2016-07-14 08:39:39 -07:00
```
2017-09-11 18:11:45 -07:00
yarn install
yarn run bootstrap
2016-07-14 08:39:39 -07:00
```
2017-09-11 18:11:45 -07:00
Then start the watcher and examples server:
2016-07-14 08:39:39 -07:00
```
2017-09-11 18:11:45 -07:00
yarn run watch
2016-07-14 08:39:39 -07:00
```
2017-09-11 18:11:45 -07:00
Now you can open up `http://localhost:8080/dev.html` in your browser and you'll see the examples site. Any changes you make to the source code will be immediately reflected when you refresh the page.