Remove old docs
This commit is contained in:
		
							parent
							
								
									06326eeb32
								
							
						
					
					
						commit
						8fb15b77a1
					
				@ -1,54 +0,0 @@
 | 
				
			|||||||
# AsyncDrawable.Loader
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
By default this library does not render any of the images. It's done to simplify rendering of text-based markdown. But if images must be supported, then the `AsyncDrawable.Loader` can be specified whilst building a `SpannableConfiguration` instance:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
```java
 | 
					 | 
				
			||||||
final AsyncDrawable.Loader loader = new AsyncDrawable.Loader() {
 | 
					 | 
				
			||||||
    @Override
 | 
					 | 
				
			||||||
    public void load(@NonNull String destination, @NonNull final AsyncDrawable drawable) {
 | 
					 | 
				
			||||||
        // `download` method is here for demonstration purposes, it's not included in this interface
 | 
					 | 
				
			||||||
        download(destination, new Callback() {
 | 
					 | 
				
			||||||
            @Override
 | 
					 | 
				
			||||||
            public void onDownloaded(Drawable d) {
 | 
					 | 
				
			||||||
                // additionally we can call `drawable.isAttached()`
 | 
					 | 
				
			||||||
                // to ensure if AsyncDrawable is in layout
 | 
					 | 
				
			||||||
                drawable.setResult(d);
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Override
 | 
					 | 
				
			||||||
    public void cancel(@NonNull String destination) {
 | 
					 | 
				
			||||||
        // cancel download here
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// `this` here referrs to a Context instance
 | 
					 | 
				
			||||||
final SpannableConfiguration configuration = SpannableConfiguration.builder(this)
 | 
					 | 
				
			||||||
        .asyncDrawableLoader(loader)
 | 
					 | 
				
			||||||
        .build();
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
There is also standalone artifact that supports image loading *out-of-box* (including support for **SVG** & **GIF**), but provides little to none configuration and could be somewhat not optimal. Please refer to the [README][mil-readme] of the module.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
### Contents
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
* [SpannableConfiguration]
 | 
					 | 
				
			||||||
* * [SpannableTheme]
 | 
					 | 
				
			||||||
* * [AsyncDrawableLoader]
 | 
					 | 
				
			||||||
* * [SyntaxHighlight]
 | 
					 | 
				
			||||||
* * [LinkResolver]
 | 
					 | 
				
			||||||
* * [UrlProcessor]
 | 
					 | 
				
			||||||
* * [HtmlParser]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[SpannableConfiguration]: ./SpannableConfiguration.md
 | 
					 | 
				
			||||||
[SpannableTheme]: ./SpannableTheme.md
 | 
					 | 
				
			||||||
[AsyncDrawableLoader]: ./AsyncDrawableLoader.md
 | 
					 | 
				
			||||||
[SyntaxHighlight]: ./SyntaxHighlight.md
 | 
					 | 
				
			||||||
[LinkResolver]: ./LinkResolver.md
 | 
					 | 
				
			||||||
[UrlProcessor]: ./UrlProcessor.md
 | 
					 | 
				
			||||||
[HtmlParser]: ./HtmlParser.md
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[mil-readme]: ../library-image-loader/README.md
 | 
					 | 
				
			||||||
@ -1,60 +0,0 @@
 | 
				
			|||||||
# HtmlParser
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
As markdown supports HTML to be inlined, we need to introduce another entity that does (limited) parsing. Obtain an instance of `SpannableHtmlParser` via one of these factory methods:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
```java
 | 
					 | 
				
			||||||
SpannableHtmlParser.create(SpannableTheme, AsyncDrawable.Loader)
 | 
					 | 
				
			||||||
SpannableHtmlParser.create(SpannableTheme, AsyncDrawable.Loader, UrlProcessor, LinkSpan.Resolver)
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Or, if further tweaking is requered builder methods:
 | 
					 | 
				
			||||||
```java
 | 
					 | 
				
			||||||
// creates empty builder
 | 
					 | 
				
			||||||
SpannableHtmlParser.builder();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// creates builder that is set-up to default values
 | 
					 | 
				
			||||||
SpannableHtmlParser.builderWithDefaults(
 | 
					 | 
				
			||||||
    @NonNull SpannableTheme theme,
 | 
					 | 
				
			||||||
    @Nullable AsyncDrawable.Loader asyncDrawableLoader,
 | 
					 | 
				
			||||||
    @Nullable UrlProcessor urlProcessor,
 | 
					 | 
				
			||||||
    @Nullable LinkSpan.Resolver resolver
 | 
					 | 
				
			||||||
)
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Builder with defaults additionally handles these HTML tags:
 | 
					 | 
				
			||||||
* `b`, `strong`
 | 
					 | 
				
			||||||
* `i`, `em`, `cite`, `dfn`
 | 
					 | 
				
			||||||
* `sup`
 | 
					 | 
				
			||||||
* `sub`
 | 
					 | 
				
			||||||
* `u`
 | 
					 | 
				
			||||||
* `del`, `s`, `strike`
 | 
					 | 
				
			||||||
* `a`
 | 
					 | 
				
			||||||
* `img` (only if `AsyncDrawable.Loader` was provided)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
You can add own simple tags handling (or override default) via:
 | 
					 | 
				
			||||||
```java
 | 
					 | 
				
			||||||
SpannableHtmlParser.Builder.simpleTag(String, SpanProvider)
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Please note, that not all tags are possible to handle via this. These are so called `void` tags ([link](https://www.w3.org/TR/html51/syntax.html#void-elements)) and so-called `html-blocks` ([link](http://spec.commonmark.org/0.18/#html-blocks)). An exception is made only for `img` tag -> it's possible to handle it via `imageProvider` property in `Builder`
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
### Contents
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
* [SpannableConfiguration]
 | 
					 | 
				
			||||||
* * [SpannableTheme]
 | 
					 | 
				
			||||||
* * [AsyncDrawableLoader]
 | 
					 | 
				
			||||||
* * [SyntaxHighlight]
 | 
					 | 
				
			||||||
* * [LinkResolver]
 | 
					 | 
				
			||||||
* * [UrlProcessor]
 | 
					 | 
				
			||||||
* * [HtmlParser]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[SpannableConfiguration]: ./SpannableConfiguration.md
 | 
					 | 
				
			||||||
[SpannableTheme]: ./SpannableTheme.md
 | 
					 | 
				
			||||||
[AsyncDrawableLoader]: ./AsyncDrawableLoader.md
 | 
					 | 
				
			||||||
[SyntaxHighlight]: ./SyntaxHighlight.md
 | 
					 | 
				
			||||||
[LinkResolver]: ./LinkResolver.md
 | 
					 | 
				
			||||||
[UrlProcessor]: ./UrlProcessor.md
 | 
					 | 
				
			||||||
[HtmlParser]: ./HtmlParser.md
 | 
					 | 
				
			||||||
@ -1,28 +0,0 @@
 | 
				
			|||||||
# LinkResolver
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Link resolver is used to navigate to clicked link. By default `LinkResolverDef` is used and it just constructs an `Intent` and launches activity that can handle it, or silently fails if activity cannot be resolved. The main interface:
 | 
					 | 
				
			||||||
```java
 | 
					 | 
				
			||||||
public interface Resolver {
 | 
					 | 
				
			||||||
    void resolve(View view, @NonNull String link);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
### Contents
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
* [SpannableConfiguration]
 | 
					 | 
				
			||||||
* * [SpannableTheme]
 | 
					 | 
				
			||||||
* * [AsyncDrawableLoader]
 | 
					 | 
				
			||||||
* * [SyntaxHighlight]
 | 
					 | 
				
			||||||
* * [LinkResolver]
 | 
					 | 
				
			||||||
* * [UrlProcessor]
 | 
					 | 
				
			||||||
* * [HtmlParser]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[SpannableConfiguration]: ./SpannableConfiguration.md
 | 
					 | 
				
			||||||
[SpannableTheme]: ./SpannableTheme.md
 | 
					 | 
				
			||||||
[AsyncDrawableLoader]: ./AsyncDrawableLoader.md
 | 
					 | 
				
			||||||
[SyntaxHighlight]: ./SyntaxHighlight.md
 | 
					 | 
				
			||||||
[LinkResolver]: ./LinkResolver.md
 | 
					 | 
				
			||||||
[UrlProcessor]: ./UrlProcessor.md
 | 
					 | 
				
			||||||
[HtmlParser]: ./HtmlParser.md
 | 
					 | 
				
			||||||
@ -1,43 +0,0 @@
 | 
				
			|||||||
# SpannableConfiguration
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
In order to render correctly markdown, this library needs a `SpannableConfiguration` instance. It has 2 factory methods:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
```java
 | 
					 | 
				
			||||||
// creates default instance
 | 
					 | 
				
			||||||
SpannableConfiguration.create(Context);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// returns configurable Builder
 | 
					 | 
				
			||||||
SpannableConfiguration.builder(Context);
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
`SpannableConfiguration.Builder` class has these configurable properties (which are described in more detail further):
 | 
					 | 
				
			||||||
```java
 | 
					 | 
				
			||||||
public Builder theme(SpannableTheme theme);
 | 
					 | 
				
			||||||
public Builder asyncDrawableLoader(AsyncDrawable.Loader asyncDrawableLoader);
 | 
					 | 
				
			||||||
public Builder syntaxHighlight(SyntaxHighlight syntaxHighlight);
 | 
					 | 
				
			||||||
public Builder linkResolver(LinkSpan.Resolver linkResolver);
 | 
					 | 
				
			||||||
public Builder urlProcessor(UrlProcessor urlProcessor);
 | 
					 | 
				
			||||||
public Builder htmlParser(SpannableHtmlParser htmlParser);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// and obviously:
 | 
					 | 
				
			||||||
public SpannableConfiguration build();
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
### Contents
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
* [SpannableConfiguration]
 | 
					 | 
				
			||||||
* * [SpannableTheme]
 | 
					 | 
				
			||||||
* * [AsyncDrawableLoader]
 | 
					 | 
				
			||||||
* * [SyntaxHighlight]
 | 
					 | 
				
			||||||
* * [LinkResolver]
 | 
					 | 
				
			||||||
* * [UrlProcessor]
 | 
					 | 
				
			||||||
* * [HtmlParser]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[SpannableConfiguration]: ./SpannableConfiguration.md
 | 
					 | 
				
			||||||
[SpannableTheme]: ./SpannableTheme.md
 | 
					 | 
				
			||||||
[AsyncDrawableLoader]: ./AsyncDrawableLoader.md
 | 
					 | 
				
			||||||
[SyntaxHighlight]: ./SyntaxHighlight.md
 | 
					 | 
				
			||||||
[LinkResolver]: ./LinkResolver.md
 | 
					 | 
				
			||||||
[UrlProcessor]: ./UrlProcessor.md
 | 
					 | 
				
			||||||
[HtmlParser]: ./HtmlParser.md
 | 
					 | 
				
			||||||
@ -1,136 +0,0 @@
 | 
				
			|||||||
# SpannableTheme
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
`SpannableTheme` controls the appearance of rendered markdown. It has pretty reasonable defaults, which are established based on style of a TextView to which it is applied. It has some factory methods:
 | 
					 | 
				
			||||||
```java
 | 
					 | 
				
			||||||
// creates ready-to-use SpannableThemeObject
 | 
					 | 
				
			||||||
SpannableTheme.create(Context);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// can be used to tweak default appearance
 | 
					 | 
				
			||||||
SpannableTheme.builderWithDefaults(Context);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// returns empty builder (no default values are set)
 | 
					 | 
				
			||||||
SpannableTheme.builder();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// returns a builder that is instantiated with all values from specified SpannableTheme
 | 
					 | 
				
			||||||
SpannableTheme.builder(SpannableTheme copyFrom);
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
`SpannableTheme.Builder` have these configurations:
 | 
					 | 
				
			||||||
#### Link
 | 
					 | 
				
			||||||
```java
 | 
					 | 
				
			||||||
public Builder linkColor(@ColorInt int linkColor);
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#### Block
 | 
					 | 
				
			||||||
```java
 | 
					 | 
				
			||||||
// left margin for: lists & quotes (text is shifted)
 | 
					 | 
				
			||||||
public Builder blockMargin(@Dimension int blockMargin);
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#### Quote
 | 
					 | 
				
			||||||
```java
 | 
					 | 
				
			||||||
// width of quote indication (the `|`)
 | 
					 | 
				
			||||||
public Builder blockQuoteWidth(@Dimension int blockQuoteWidth);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// color of `|` quote indication
 | 
					 | 
				
			||||||
public Builder blockQuoteColor(@ColorInt int blockQuoteColor);
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#### Lists
 | 
					 | 
				
			||||||
```java
 | 
					 | 
				
			||||||
// color of list item bullets(●, ○, ■)/numbers
 | 
					 | 
				
			||||||
public Builder listItemColor(@ColorInt int listItemColor);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// stroke width for list bullet (2nd level - `○`)
 | 
					 | 
				
			||||||
public Builder bulletListItemStrokeWidth(@Dimension int bulletListItemStrokeWidth);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// width of list bullet (●, ○, ■)
 | 
					 | 
				
			||||||
public Builder bulletWidth(@Dimension int bulletWidth);
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#### Code
 | 
					 | 
				
			||||||
```java
 | 
					 | 
				
			||||||
// text color for `code` blocks
 | 
					 | 
				
			||||||
public Builder codeTextColor(@ColorInt int codeTextColor);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// background color for `code` blocks
 | 
					 | 
				
			||||||
public Builder codeBackgroundColor(@ColorInt int codeBackgroundColor);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// left margin for multiline `code` blocks
 | 
					 | 
				
			||||||
public Builder codeMultilineMargin(@Dimension int codeMultilineMargin);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// typeface of `code` block
 | 
					 | 
				
			||||||
public Builder codeTypeface(@NonNull Typeface codeTypeface);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// text size for `code` block
 | 
					 | 
				
			||||||
public Builder codeTextSize(@Dimension int codeTextSize);
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#### Headings
 | 
					 | 
				
			||||||
```java
 | 
					 | 
				
			||||||
// height of the `break` line under h1 & h2
 | 
					 | 
				
			||||||
public Builder headingBreakHeight(@Dimension int headingBreakHeight);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// color of the `break` line under h1 & h2
 | 
					 | 
				
			||||||
public Builder headingBreakColor(@ColorInt int headingBreakColor);
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#### SuperScript & SupScript
 | 
					 | 
				
			||||||
```java
 | 
					 | 
				
			||||||
// ratio for <sup> & <sub> text size (calculated based on TextView text size)
 | 
					 | 
				
			||||||
public Builder scriptTextSizeRatio(@FloatRange(from = .0F, to = Float.MAX_VALUE) float scriptTextSizeRatio);
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#### Thematic break
 | 
					 | 
				
			||||||
```java
 | 
					 | 
				
			||||||
// the `---` thematic break color
 | 
					 | 
				
			||||||
public Builder thematicBreakColor(@ColorInt int thematicBreakColor);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// the `---` thematic break height
 | 
					 | 
				
			||||||
public Builder thematicBreakHeight(@Dimension int thematicBreakHeight);
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#### Tables
 | 
					 | 
				
			||||||
```java
 | 
					 | 
				
			||||||
// padding inside a table cell
 | 
					 | 
				
			||||||
public Builder tableCellPadding(@Dimension int tableCellPadding);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// color of table borders
 | 
					 | 
				
			||||||
public Builder tableBorderColor(@ColorInt int tableBorderColor);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// the `stroke` width of table border
 | 
					 | 
				
			||||||
public Builder tableBorderWidth(@Dimension int tableBorderWidth);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// the background of odd table rows
 | 
					 | 
				
			||||||
public Builder tableOddRowBackgroundColor(@ColorInt int tableOddRowBackgroundColor);
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#### Task lists
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Task lists are supported but with some limitations. First of all, task list cannot be nested
 | 
					 | 
				
			||||||
(in a list, quote, etc). By default (if used factory method `builderWithDefaults`) TaskListDrawable
 | 
					 | 
				
			||||||
will be used with `linkColor` as the primary color and `windowBackground` as the checkMarkColor.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
```java
 | 
					 | 
				
			||||||
public Builder taskListDrawable(@NonNull Drawable taskListDrawable);
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
### Contents
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
* [SpannableConfiguration]
 | 
					 | 
				
			||||||
* * [SpannableTheme]
 | 
					 | 
				
			||||||
* * [AsyncDrawableLoader]
 | 
					 | 
				
			||||||
* * [SyntaxHighlight]
 | 
					 | 
				
			||||||
* * [LinkResolver]
 | 
					 | 
				
			||||||
* * [UrlProcessor]
 | 
					 | 
				
			||||||
* * [HtmlParser]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[SpannableConfiguration]: ./SpannableConfiguration.md
 | 
					 | 
				
			||||||
[SpannableTheme]: ./SpannableTheme.md
 | 
					 | 
				
			||||||
[AsyncDrawableLoader]: ./AsyncDrawableLoader.md
 | 
					 | 
				
			||||||
[SyntaxHighlight]: ./SyntaxHighlight.md
 | 
					 | 
				
			||||||
[LinkResolver]: ./LinkResolver.md
 | 
					 | 
				
			||||||
[UrlProcessor]: ./UrlProcessor.md
 | 
					 | 
				
			||||||
[HtmlParser]: ./HtmlParser.md
 | 
					 | 
				
			||||||
@ -1,37 +0,0 @@
 | 
				
			|||||||
# Syntax highlight
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
This library does not provide ready-to-be-used implementation of syntax highlight, but it can be added via `SyntaxHighlight` interface whilst building `SpannableConfiguration`:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
```java
 | 
					 | 
				
			||||||
final SyntaxHighlight syntaxHighlight = new SyntaxHighlight() {
 | 
					 | 
				
			||||||
    @NonNull
 | 
					 | 
				
			||||||
    @Override
 | 
					 | 
				
			||||||
    public CharSequence highlight(@Nullable String info, @NonNull String code) {
 | 
					 | 
				
			||||||
        // create Spanned of highlight here
 | 
					 | 
				
			||||||
        return null; // must not return `null` here
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
final SpannableConfiguration configuration = SpannableConfiguration.builder(this)
 | 
					 | 
				
			||||||
        .syntaxHighlight(syntaxHighlight)
 | 
					 | 
				
			||||||
        .build();
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
### Contents
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
* [SpannableConfiguration]
 | 
					 | 
				
			||||||
* * [SpannableTheme]
 | 
					 | 
				
			||||||
* * [AsyncDrawableLoader]
 | 
					 | 
				
			||||||
* * [SyntaxHighlight]
 | 
					 | 
				
			||||||
* * [LinkResolver]
 | 
					 | 
				
			||||||
* * [UrlProcessor]
 | 
					 | 
				
			||||||
* * [HtmlParser]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[SpannableConfiguration]: ./SpannableConfiguration.md
 | 
					 | 
				
			||||||
[SpannableTheme]: ./SpannableTheme.md
 | 
					 | 
				
			||||||
[AsyncDrawableLoader]: ./AsyncDrawableLoader.md
 | 
					 | 
				
			||||||
[SyntaxHighlight]: ./SyntaxHighlight.md
 | 
					 | 
				
			||||||
[LinkResolver]: ./LinkResolver.md
 | 
					 | 
				
			||||||
[UrlProcessor]: ./UrlProcessor.md
 | 
					 | 
				
			||||||
[HtmlParser]: ./HtmlParser.md
 | 
					 | 
				
			||||||
@ -1,40 +0,0 @@
 | 
				
			|||||||
# UrlProcessor
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
If you wish to process urls (links & images) that markdown contains, the `UrlProcessor` can be used:
 | 
					 | 
				
			||||||
```java
 | 
					 | 
				
			||||||
final UrlProcessor urlProcessor = new UrlProcessor() {
 | 
					 | 
				
			||||||
    @NonNull
 | 
					 | 
				
			||||||
    @Override
 | 
					 | 
				
			||||||
    public String process(@NonNull String destination) {
 | 
					 | 
				
			||||||
        // modify the `destination` or return as-is
 | 
					 | 
				
			||||||
        return null;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
final SpannableConfiguration configuration = SpannableConfiguration.builder(this)
 | 
					 | 
				
			||||||
        .urlProcessor(urlProcessor)
 | 
					 | 
				
			||||||
        .build();
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
The primary goal of additing this abstraction is to give ability to convert relative urls to absolute ones. If it fits your purpose, then `UrlProcessorRelativeToAbsolute` can be used:
 | 
					 | 
				
			||||||
```java
 | 
					 | 
				
			||||||
final UrlProcessor urlProcessor = new UrlProcessorRelativeToAbsolute("https://this-is-base.org");
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
### Contents
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
* [SpannableConfiguration]
 | 
					 | 
				
			||||||
* * [SpannableTheme]
 | 
					 | 
				
			||||||
* * [AsyncDrawableLoader]
 | 
					 | 
				
			||||||
* * [SyntaxHighlight]
 | 
					 | 
				
			||||||
* * [LinkResolver]
 | 
					 | 
				
			||||||
* * [UrlProcessor]
 | 
					 | 
				
			||||||
* * [HtmlParser]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[SpannableConfiguration]: ./SpannableConfiguration.md
 | 
					 | 
				
			||||||
[SpannableTheme]: ./SpannableTheme.md
 | 
					 | 
				
			||||||
[AsyncDrawableLoader]: ./AsyncDrawableLoader.md
 | 
					 | 
				
			||||||
[SyntaxHighlight]: ./SyntaxHighlight.md
 | 
					 | 
				
			||||||
[LinkResolver]: ./LinkResolver.md
 | 
					 | 
				
			||||||
[UrlProcessor]: ./UrlProcessor.md
 | 
					 | 
				
			||||||
[HtmlParser]: ./HtmlParser.md
 | 
					 | 
				
			||||||
@ -17,7 +17,7 @@ It gives ability to display markdown in all TextView widgets (**TextView**,
 | 
				
			|||||||
**Button**, **Switch**, **CheckBox**, etc), **Toasts** and all other places that accept
 | 
					**Button**, **Switch**, **CheckBox**, etc), **Toasts** and all other places that accept
 | 
				
			||||||
**Spanned content**. Library provides reasonable defaults to display style of a markdown content
 | 
					**Spanned content**. Library provides reasonable defaults to display style of a markdown content
 | 
				
			||||||
but also gives all the means to tweak the appearance if desired. All markdown features 
 | 
					but also gives all the means to tweak the appearance if desired. All markdown features 
 | 
				
			||||||
listed in [commonmark spec] are supported (including support for **inlined/block HTML code**, 
 | 
					listed in <Link name="commonmark-spec" /> are supported (including support for **inlined/block HTML code**, 
 | 
				
			||||||
**markdown tables**, **images** and **syntax highlight**).
 | 
					**markdown tables**, **images** and **syntax highlight**).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Supported markdown features:
 | 
					## Supported markdown features:
 | 
				
			||||||
 | 
				
			|||||||
@ -64,4 +64,6 @@ public interface Prism4jTheme {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
> You can extend `Prism4jThemeBase` which has some helper methods
 | 
					:::tip
 | 
				
			||||||
 | 
					You can extend `Prism4jThemeBase` which has some helper methods
 | 
				
			||||||
 | 
					:::
 | 
				
			||||||
@ -45,8 +45,14 @@ public interface HtmlTag {
 | 
				
			|||||||
    @NonNull
 | 
					    @NonNull
 | 
				
			||||||
    Map<String, String> attributes();
 | 
					    Map<String, String> attributes();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * @see Inline
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
    boolean isInline();
 | 
					    boolean isInline();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * @see Block
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
    boolean isBlock();
 | 
					    boolean isBlock();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @NonNull
 | 
					    @NonNull
 | 
				
			||||||
 | 
				
			|||||||
@ -2,6 +2,8 @@ package ru.noties.markwon.html.api;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import android.support.annotation.NonNull;
 | 
					import android.support.annotation.NonNull;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.Collections;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @see MarkwonHtmlParser
 | 
					 * @see MarkwonHtmlParser
 | 
				
			||||||
 * @since 2.0.0
 | 
					 * @since 2.0.0
 | 
				
			||||||
@ -15,12 +17,12 @@ class MarkwonHtmlParserNoOp extends MarkwonHtmlParser {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void flushInlineTags(int documentLength, @NonNull FlushAction<HtmlTag.Inline> action) {
 | 
					    public void flushInlineTags(int documentLength, @NonNull FlushAction<HtmlTag.Inline> action) {
 | 
				
			||||||
 | 
					        action.apply(Collections.<HtmlTag.Inline>emptyList());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void flushBlockTags(int documentLength, @NonNull FlushAction<HtmlTag.Block> action) {
 | 
					    public void flushBlockTags(int documentLength, @NonNull FlushAction<HtmlTag.Block> action) {
 | 
				
			||||||
 | 
					        action.apply(Collections.<HtmlTag.Block>emptyList());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user