diff --git a/README.md b/README.md index 3246cba7..9046662c 100644 --- a/README.md +++ b/README.md @@ -95,6 +95,12 @@ You can now translate JavaScript to wenyan-lang using the [wenyanizer](https://g - [Plugin for Vim](https://github.com/voldikss/vim-wenyan) by [voldikss](https://github.com/voldikss) - [Plugin for Sublime Text](https://github.com/absop/SublimeWenyan) by [absop](https://github.com/absop) +### Browser Runtime + +You can now run Wenyan scripts right in your html file. + +Please refer to [Browser Runtime](./documentation/Runtime.md) + ### Advance Usage [Compiler API Specification](./documentation/Compiler-API.md) diff --git a/documentation/Runtime.md b/documentation/Runtime.md new file mode 100644 index 00000000..39d66d9d --- /dev/null +++ b/documentation/Runtime.md @@ -0,0 +1,59 @@ +[Back to README](../README.md) + +# Wenyan Browser Runtime + +You can now run Wenyan as normal Javscript script right in your html. + +[**Check out the demo**](https://jsfiddle.net/antfu/u532ny49/2/) + +## Installation + +Add following script in the `` of your html file. + +```html + +``` + +That's all, you are good to go! + +## Usage + +To use wenyan in script, you **HAVE TO** specify `type="application/wenyan"` for the ` +``` + +### Scoped script + +By default, all the variables in wenyan will exposed globally. For the previous example, `甲` is accessible by `window.甲`. If you do not want to messed up your globals, you can specify the `scoped` attr. + +```html + +``` + +### Remote scripts + +You can import remote scripts as you will do for Javascript. + +```html + +``` + +### DOM Hacks + +There are some hacks you can do to access the DOM and browser APIs. This allows wenyan to do some realworld applications. + +```html + +``` diff --git a/site/ide.html b/site/ide.html index 724b0d9b..ac7eaf4f 100644 --- a/site/ide.html +++ b/site/ide.html @@ -11,269 +11,838 @@ - - + +