JavaScript markup parser for the Savvy syntax. Play with the Demo.
- Jasmine Unit Tested
- jQuery or jqLite (for use with Angular)
- Variables and Functions
Include the jquery.savvy.js
file.
$('.savvy').savvy();
$('.savvy').savvy(text);
$.savvy(element, text);
exmaple here
The parser allows for inline variable definitions and functions. View the full syntax documention.
Variables can be defined with the @
symbol with a name containing letters or numbers. Any value after the next space will be saved globally to the variable.
@hello world!
@hello
<p>world!</p>
Note: To redefine a variable use @@
instead of a single @
.
Functions allow basic tempates and the execution of pre-defined JavaScript.
@twitter(username){
<a href="https://twitter.com/@username">@username</a>
}
Follow me on twitter: @twitter(Templarian)
<p>Follow me on twitter: <a href="https://twitter.com/Templarian">Templarian</a></p>