Skip to content

koara/koara-java-html

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Koara

Build Status Coverage Status ![Latest Version](https://img.shields.io/maven-central/v/io.koara/koara-html.svg?label=Maven Central) License

Koara-java-html

Koara is a modular lightweight markup language. This project can render the koara AST to Html in Java.
The AST is created by the core koara parser.

Getting started

  • Download JAR file

  • Gradle

    dependencies {
      compile "com.codeaddslife.koara:koara-html:0.15.0"
    }
  • Maven

    <dependency>
      <groupId>com.codeaddslife.koara</groupId>
      <artifactId>koara-html</artifactId>
      <version>0.15.0</version>
    </dependency>

Usage

package demo;

import io.koara.Parser;
import io.koara.ast.Document;
import Html5Renderer;

public class App {

	public static void main(String[] args) {
		Parser parser = new Parser();
		Document result = parser.parse("Hello World!");
		Html5Renderer renderer = new Html5Renderer();
		result.accept(renderer);
		System.out.println(renderer.getOutput());
	}
	
}

Configuration

You can configure the Renderer:

  • parser.setHeadingIds(boolean headingIds)
    Default: false

    Specifiy if an id should be set to heading-elements.

  • parser.setHardwrap(boolean hardWrap)
    Default: false

    Specify if newlines should be hard-wrapped (return-based linebreaks) by default.

  • renderer.setPartial(boolean partial)
    Default: true

    When false, the output will be wrapped with a <html> and <body> tag to make a complete Html document.