1.1.0
FactoryWARNING
This is documentation for legacy versions. For the most current version click here.
SpannableFactory
is used to create Span implementations.
SpannableConfiguration.builder(context)
.factory(SpannableFactory)
.build();
Markwon
provides default SpannableFactoryDef
implementation that is
used by default.
Spans:
strongEmphasis
emphasis
blockQuote
code
orderedListItem
bulletListItem
thematicBreak
heading
strikethrough
taskListItem
tableRow
paragraph
1.1.1image
link
superScript
(HTML content only)subScript
(HTML content only)underline
(HTML content only)
TIP
SpannableFactory
can be used to ignore some kinds of text markup. If, for example,
you do not wish to apply emphasis styling to your final result, just return null
from emphasis
factory method:
@Nullable
@Override
public Object emphasis() {
return null;
}
TIP
All factory methods in SpannableFactory
return an Object
, but you can actually
return an array of Objects if you wish to apply multiple Spans to a single styling node.
For example, let's make all emphasis also red:
@Nullable
@Override
public Object emphasis() {
return new Object[] {
super.emphasis(),
new ForegroundColorSpan(Color.RED)
};
}