Giter Site home page Giter Site logo

lsliwko / kefirbb Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kefirfromperm/kefirbb

0.0 1.0 0.0 517 KB

A flexible Java text processor. BB, BBCode, BB-code, HTML, Textile, Markdown, parser, translator, converter.

License: GNU Lesser General Public License v3.0

Java 100.00%

kefirbb's Introduction

KefirBB

Build Status Download Maven Central javadoc.io OpenHUB

About

KefirBB is a Java-library for text processing. Initially it was developed for BBCode (Bulletin Board Code) to HTML translation. But flexible configuration allows to use it in different cases. For example XML-to-HTML translation or for HTML filtration. Now it supports Textile and Markdown markup languages. Actually it's the most powerfull and flexible Java-library for BBCode parsing.

Maven dependency

<dependency>
    <groupId>org.kefirsf</groupId>
    <artifactId>kefirbb</artifactId>
    <version>1.5</version>
</dependency>

Usage

Convert BBCode

KefirBB fully supports converting from BBCode markup language to HTML. The syntax of BBCode is described at BBCode - Wikipedia.

TextProcessor processor = BBProcessorFactory.getInstance().create();
assert "<b>text</b>".equals(processor.process("[b]text[/b]"));

HTML Filtration

If you don't want to use special markup languages in your site but you have to safe your users from XSS-attacks you can use KefirBB configuration for HTMl filtration. It prevents using of javascript, styles etc.

TextProcessor processor = BBProcessorFactory.getInstance()
    .createFromResource(ConfigurationFactory.SAFE_HTML_CONFIGURATION_FILE);
assert "<b>text</b>".equals(processor.process("<b onclick=\"javascript:alert('Fail!');\">test</B>"));

Convert Textile

KefirBB fully supports Textile markup language. It's described at TxStyle

TextProcessor processor = BBProcessorFactory.getInstance()
    .createFromResource(ConfigurationFactory.TEXTILE_CONFIGURATION_FILE);
assert "<p><b>text</b></p>".equals(processor.process("**text**"));

Convert Markdown

KefirBB supports Markdown markup language partially described at Markdown Syntax. It doesn't support fully blockquotes and lists.

TextProcessor processor = BBProcessorFactory.getInstance()
    .createFromResource(ConfigurationFactory.MARKDOWN_CONFIGURATION_FILE);
assert "<p><strong>text</strong></p>".equals(processor.process("**text**"));

Your custom configuration

Also you can use your own configuration or customize existing. Just put your own configuration to classpath:kefirbb.xml.

Documentation

You can find full documentation in the wiki of the project.

Support

You can report bugs at GitHub Issues. Also you can ask me questions by email [email protected].

Donation

If you want to give me a beer just send some money to https://www.paypal.me/kefir

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.