0.14.0 • Published 7 years ago
koara-html v0.14.0
Koara-js-html
Koara is a modular lightweight markup language. This project can render the koara AST to Html in Javascript.
The AST is created by the core koara parser.
Getting started
- Download ZIP file
Npm
npm install koara-html --save-dev
Bower
bower install koara-html
Usage
Node
var koara = require('koara'); var koaraHtml = require('koara-html'); var parser = new koara.Parser(); var result = parser.parse("Hello World!"); var renderer = new koaraHtml.Html5Renderer(); result.accept(renderer); console.log(renderer.getOutput());
Browser
<!doctype html> <html> <body> <script type="text/javascript" src="koara.min.js"></script> <script type="text/javascript" src="koara-html.min.js"></script> <script type="text/javascript"> var parser = new koara.Parser(); var result = parser.parse("Hello World!"); var renderer = new koaraHtml.Html5Renderer(); result.accept(renderer); document.write(renderer.getOutput()); </script> </body> </html>
Configuration
You can configure the Renderer:
renderer.hardWrap
Default:false
Specify if newlines should be hard-wrapped (return-based linebreaks) by default.
renderer.partial
Default:true
When false, the output will be wrapped with a
<html>
and<body>
tag to make a complete Html document.