- Commit
- 32e92dee9363d9ef7674ae11234cecfd3ae560f9
- Parent
- 1d24a153e234b458724d5d9ae8afd700b7025cb4
- Author
- John MacFarlane <jgm@berkeley.edu>
- Date
Added js usage example.
My personal build of CMark ✏️
Added js usage example.
1 file changed, 18 insertions, 11 deletions
Status | File Name | N° Changes | Insertions | Deletions |
Modified | README.md | 29 | 18 | 11 |
diff --git a/README.md b/README.md @@ -30,12 +30,28 @@ Scott Chacon and Ben Straub): The JavaScript implementation is a single JavaScript file, with -no dependencies, that can be linked to in an HTML page. A node -package is also available; it includes a command-line tool called +no dependencies, that can be linked to in an HTML page. Here +is a simple usage example: + +``` javascript +var reader = new commonmark.DocParser(); +var writer = new commonmark.HtmlRenderer(); +var parsed = reader.parse("Hello *world*"); +var result = writer.render(parsed); +``` + +A node package is also available; it includes a command-line tool called `commonmark`. [Try it now!](http://spec.commonmark.org/dingus.html) +**A note on security:** +Neither implementation attempts to sanitize link attributes or +raw HTML. If you use these libraries in applications that accept +untrusted user input, you must run the output through an HTML +sanitizer to protect against +[XSS attacks](http://en.wikipedia.org/wiki/Cross-site_scripting). + Installing ---------- @@ -89,15 +105,6 @@ or `make dingus` will start an interactive dingus you can use to play with the JavaScript implementation: -A note on security ------------------- - -Neither implementation attempts to sanitize link attributes or -raw HTML. If you use these libraries in applications that accept -untrusted user input, you must run the output through an HTML -sanitizer to protect against -[XSS attacks](http://en.wikipedia.org/wiki/Cross-site_scripting). - The spec --------