
* Add `html-parser-api` and `html-parser-impl` modules * Add `HtmlEmptyTagReplacement` * Implement Appendable and CharSequence in SpannableBuilder * Renamed library modules to reflect maven artifact names * Rename `markwon-syntax` to `markwon-syntax-highlight` * Add HtmlRenderer asbtraction * Add CssInlineStyleParser * Fix Theme#listItemColor and OL * Fix task list block parser to revert parsing state when line is not matching * Defined test format files * image-loader add datauri parser * image-loader add support for inline data uri image references * Add travis configuration * Fix image with width greater than canvas scaled * Fix blockquote span * Dealing with white spaces at the end of a document * image-loader add SchemeHandler abstraction * Add sample-latex-math module
42 lines
1.6 KiB
Markdown
42 lines
1.6 KiB
Markdown
# Markwon View
|
|
|
|
[](http://search.maven.org/#search|ga|1|g%3A%22ru.noties%22%20AND%20a%3A%markwon-view%22)
|
|
|
|
This is simple library containing 2 views that are able to display markdown:
|
|
* MarkwonView - extends `android.view.TextView`
|
|
* MarkwonViewCompat - extends `android.support.v7.widget.AppCompatTextView`
|
|
|
|
Both of them implement common `IMarkwonView` interface:
|
|
```java
|
|
public interface IMarkwonView {
|
|
|
|
interface ConfigurationProvider {
|
|
@NonNull
|
|
SpannableConfiguration provide(@NonNull Context context);
|
|
}
|
|
|
|
void setConfigurationProvider(@NonNull ConfigurationProvider provider);
|
|
|
|
void setMarkdown(@Nullable String markdown);
|
|
void setMarkdown(@Nullable SpannableConfiguration configuration, @Nullable String markdown);
|
|
|
|
@Nullable
|
|
String getMarkdown();
|
|
}
|
|
```
|
|
|
|
Both views support layout-preview in Android Studio (with some exceptions, for example, bold span is not rendered due to some limitations of layout preview).
|
|
These are XML attributes:
|
|
```
|
|
app:mv_markdown="string"
|
|
app:mv_configurationProvider="string"
|
|
```
|
|
|
|
`mv_markdown` accepts a string and represents raw markdown
|
|
|
|
`mv_configurationProvider` accepts a string and represents a full class name of a class of type `ConfigurationProvider`,
|
|
for example: `com.example.my.package.MyConfigurationProvider` (this class must have an empty constructor
|
|
in order to be instantiated via reflection).
|
|
|
|
Please note that those views parse markdown in main thread, so their usage must be for relatively small markdown portions only
|