X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=README.md;h=af50f19862927609a4b65f025ab2e05173586abb;hb=c8370edb3147dad5c8921f6dd4509a3c94658e0c;hp=8f86eec41a4ed0a2777cad6beff053544e29a54e;hpb=a77c7e459842f78d78161bc4a3f330ec1d0c2693;p=peach-html5-editor.git diff --git a/README.md b/README.md index 8f86eec..af50f19 100644 --- a/README.md +++ b/README.md @@ -16,40 +16,68 @@ HTML5 parser: all (1581) tests pass. Works in the browser and node.js WYSIWYG editor: planning stages -Getting Started ---------------- +Quick Start Guide +----------------- -Recommended: see "With CoffeeScript" below +1. Open ``parser_tests_coffee.html`` in your browser. -(experimental) Alternate: see "Without Compiling" +2. Open the console (right-click, inspect this element, console) +3. After a few seconds, you should see "Tests passed: 1581, Failed: 0" in the + console. -With CoffeeScript ------------------- +4. Try running the parser in the console, example: -You can get CoffeeScript with a command such as this: + window.wheic_parser.parse("

foo

", {fragment: "body"}) - apt-get install coffeescript +For further reading, see "Running Under node.js" below. -or - npm install -g coffee-script +Running Under node.js +--------------------- +Dependencies: node.js, CoffeeScript -Then, to test in the browser, run ``make``, then open ``index.html`` in your -favorite browser. +1. Install node.js https://nodejs.org/en/ -Or, to run the tests on the commandline, run ``coffee test.coffee`` +2. Install CoffeeScript. Try: + apt-get install coffeescript + or -Without CoffeeScript ------------------ + npm install -g coffee-script + +4. Compile to javascript: + + make + +Now you can do any of these things in any order: + +* Run the tests directly from CoffeeScript: + + coffee parser_tests.coffee + +* Test the compiled (javascript) parser in your favorite browser by opening + up ``parser_tests.html`` and looking at the console. + +* Run tests via compiled code: + + nodejs parser_tests.js + +* Try using the parser in your own javascript node.js project: + + var html5 = require('./parser.js'); + var dom = html5.parse("

hi

", {fragment: 'body'}); + ... + +* Try using the parser in your own CoffeeScript node.js project: -It is recommended to install CoffeeScript (see With CoffeeScript above), but it -should be pretty easy to get your browser to compile the CoffeScript on the -fly, to avoid installing anything. See the instructions here: + html5 = require './parser.js' + dom = html5.parse "

hi

", fragment: 'body' + ... - http://coffeescript.org/#scripts + Note: the CoffeeScript compile time is significant, so you'll want to use + the compiled javascript even though you could use the ``.coffee`` version. Feedback, Questions, Etc