Updated README.md for library-view
module
This commit is contained in:
parent
332675cdee
commit
2102f325a0
@ -3,7 +3,8 @@
|
||||
# Markwon
|
||||
|
||||
[](http://search.maven.org/#search|ga|1|g%3A%22ru.noties%22%20AND%20a%3A%markwon%22)
|
||||
[](http://search.maven.org/#search|ga|1|g%3A%22ru.noties%22%20AND%20a%3A%markwon%22)
|
||||
[](http://search.maven.org/#search|ga|1|g%3A%22ru.noties%22%20AND%20a%3A%markwon-image-loader%22)
|
||||
[](http://search.maven.org/#search|ga|1|g%3A%22ru.noties%22%20AND%20a%3A%markwon-view%22)
|
||||
|
||||
Android library for rendering markdown as system-native Spannables. Based on [commonmark-java][commonmark-java]
|
||||
|
||||
@ -11,6 +12,7 @@ Android library for rendering markdown as system-native Spannables. Based on [co
|
||||
```groovy
|
||||
compile 'ru.noties:markwon:1.0.0'
|
||||
compile 'ru.noties:markwon-image-loader:1.0.0' // optional
|
||||
compile 'ru.noties:markwon-view:1.0.0' // optional
|
||||
```
|
||||
|
||||
---
|
||||
|
41
library-view/README.md
Normal file
41
library-view/README.md
Normal file
@ -0,0 +1,41 @@
|
||||
# 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
|
3
library-view/gradle.properties
Normal file
3
library-view/gradle.properties
Normal file
@ -0,0 +1,3 @@
|
||||
POM_NAME=Markwon-View
|
||||
POM_ARTIFACT_ID=markwon-view
|
||||
POM_PACKAGING=aar
|
Loading…
x
Reference in New Issue
Block a user