1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-01 04:50:27 +02:00

update examples and test contributing instructions

This commit is contained in:
Ian Storm Taylor
2016-07-14 08:39:39 -07:00
parent 0b372dcdc4
commit 2419dcc71d
2 changed files with 54 additions and 25 deletions

View File

@@ -6,16 +6,15 @@ Want to contribute to Slate? That would be awesome!
### Running Tests
To run the examples, you need to have the Slate repository cloned to your computed. After that, you need to `cd` into the directory where you cloned it, and install the dependencies from `npm`.
To run the examples, 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 from `npm`.
```
make install
```
And then build the source and run the tests:
Which will also compile the source files. Then run the tests with:
```
make dist
make test
```
@@ -25,7 +24,9 @@ And to run the linter:
make lint
```
If you need to debug something, you can add a `debugger` line to the source, and then run `make test` with the `DEBUG=true` flag enabled.
Or you can run both with `make check`, which is what is run by default.
If you need to debug something, you can add a `debugger` line to the source, and then run `make test` with the `DEBUG=true` flag enabled. Or, if you only want to run a specific test or tests, you can add the `GREP="some string"` flag which will filter the tests being run.
To keep the source rebuilding on every file change, you need to run an additional watching command:
@@ -36,27 +37,7 @@ make watch-dist
### Running Examples
To run the examples, you need to have the Slate repository cloned to your computed. After that, you need to `cd` into the directory where you cloned it, and install the dependencies from `npm`.
```
make install
```
And then build the source and run the examples server:
```
make dist
make start-examples
```
If you want to edit the source while running the examples and have those changes immediately reflected, you need to run two additional watching commands in your terminal:
```
make watch-dist
```
```
make watch-examples
```
Check out the [Examples readme](./examples) to see how to get the examples running locally!
### Pull Requests

48
examples/Readme.md Normal file
View File

@@ -0,0 +1,48 @@
# Examples
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.
- [**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.
If you have an idea for an example that shows a common use case, pull request it!
## Running the Examples
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 from `npm`.
```
make install
```
Which will also build the source. Then build the examples:
```
make examples
```
And then run the examples server:
```
make start
```
Now you can open up `http://localhost:8080` in your browser and you'll see the examples site.
If you want to edit the source while running the examples and have those changes immediately reflected, you need to run two additional watching commands in your terminal:
```
make watch-dist
```
```
make watch-examples
```