== text
:idprefix: id_ 
This addon provides *standalone* functionality.
The text addon provides functionality to perform text-based transformations like inflection of words or syntax highlighting.
        
=== Depends on
[options="header"]
|===
|Addon |Exported |Optional
|org.jboss.forge.furnace.container:simple
|no
|no
|===

== Setup
This Addon requires the following installation steps.

=== Add configuration to pom.xml

To use this addon, you must add it as a dependency in the *pom.xml* of your `forge-addon` classified artifact:

[source,xml]
----
<dependency>
   <groupId>org.jboss.forge.addon.text</groupId>
   <artifactId>text</artifactId>
   <classifier>forge-addon</classifier>
   <version>${version}</version>
</dependency>
----
== Features
Inflector for performing inflection on words:: 
Allows for camelcasing, capitalization, humanization, pluralization etc. of words.
+
[source,java]
----
@Inject private Inflector inflector;
String plural = inflector.pluralize("foo");
----
+

Highligher to color code syntax in terminal output::
Allows for color coding of the following content types:
* JAVA
* JSON
* JAVASCRIPT
* CSS
* HTML (with inline JavaScript/CSS)

When working with files you can rely on the `Highlighter` to determine the syntax based on the filename.
[source,java]
----
@Inject private Highlighter highlighter;
highlighter.byFileName(resource.getName(), resource.getContents(), output.out());
----

When working with pure content you can specify the source syntax via the contentType argument.
[source,java]
----
@Inject private Highlighter highlighter;
highlighter.byType("JAVA", resource.getContents(), output.out());
----

You can provide your own resource tokenizer for the `Highlighter` to use by implementing the interface
`org.jboss.forge.addon.text.highlight.Scanner`, and expose it either as a CDI bean or registered as a
simple service via the `org.jboss.forge.furnace.container.simple.Service` services file.

[TIP] 
====
If your addon uses a container that does not support "@Inject" annotations, services such as the `Inflector` may also be 
accessed via the `AddonRegistry`:
----
Imported<Inflector> imported = addonRegistry.getServices(Inflector.class);
Inflector inflector = imported.get();
----
====
