Update documentation web-site
This commit is contained in:
parent
3fe514aeea
commit
6c8f1c04bb
@ -10,6 +10,7 @@ import androidx.annotation.NonNull;
|
|||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
@ -18,6 +19,7 @@ import io.noties.debug.Debug;
|
|||||||
import io.noties.markwon.AbstractMarkwonPlugin;
|
import io.noties.markwon.AbstractMarkwonPlugin;
|
||||||
import io.noties.markwon.Markwon;
|
import io.noties.markwon.Markwon;
|
||||||
import io.noties.markwon.MarkwonConfiguration;
|
import io.noties.markwon.MarkwonConfiguration;
|
||||||
|
import io.noties.markwon.PrecomputedTextSetterCompat;
|
||||||
import io.noties.markwon.app.gif.GifAwarePlugin;
|
import io.noties.markwon.app.gif.GifAwarePlugin;
|
||||||
import io.noties.markwon.ext.strikethrough.StrikethroughPlugin;
|
import io.noties.markwon.ext.strikethrough.StrikethroughPlugin;
|
||||||
import io.noties.markwon.ext.tables.TablePlugin;
|
import io.noties.markwon.ext.tables.TablePlugin;
|
||||||
@ -73,6 +75,11 @@ public class MarkdownRenderer {
|
|||||||
|
|
||||||
cancel();
|
cancel();
|
||||||
|
|
||||||
|
final Markwon markwon = Markwon.builder(context)
|
||||||
|
.usePlugin(/**/)
|
||||||
|
.textSetter(PrecomputedTextSetterCompat.create(Executors.newCachedThreadPool()))
|
||||||
|
.build();
|
||||||
|
|
||||||
task = service.submit(new Runnable() {
|
task = service.submit(new Runnable() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="warning custom-block">
|
<div class="warning custom-block">
|
||||||
<p class="custom-block-title">WARNING</p>
|
<p class="custom-block-title">WARNING</p>
|
||||||
<p>This is documentation for <u>legacy 2.x.x</u> versions. For the most current version <a :href="$withBase('/')">click here.</a></p>
|
<p>This is documentation for <u>legacy</u> versions. For the most current version <a :href="$withBase('/')">click here.</a></p>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -16,9 +16,17 @@ module.exports = {
|
|||||||
{
|
{
|
||||||
text: 'API Version',
|
text: 'API Version',
|
||||||
items: [
|
items: [
|
||||||
{ text: 'Current (4.x.x)', link: '/' },
|
{
|
||||||
{ text: 'Legacy (3.x.x)', link: '/docs/v3/install.md' },
|
text: 'Latest', items: [
|
||||||
{ text: 'Legacy (2.x.x)', link: '/docs/v2/' }
|
{ text: '4.x.x', link: '/' },
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: 'Legacy', items: [
|
||||||
|
{ text: '3.x.x', link: '/docs/v3/install.md' },
|
||||||
|
{ text: '2.x.x', link: '/docs/v2/' }
|
||||||
|
]
|
||||||
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{ text: 'Changelog', link: 'https://github.com/noties/Markwon/blob/master/CHANGELOG.md' },
|
{ text: 'Changelog', link: 'https://github.com/noties/Markwon/blob/master/CHANGELOG.md' },
|
||||||
@ -83,7 +91,8 @@ module.exports = {
|
|||||||
'/docs/v4/core/spans-factory.md',
|
'/docs/v4/core/spans-factory.md',
|
||||||
'/docs/v4/core/core-plugin.md',
|
'/docs/v4/core/core-plugin.md',
|
||||||
'/docs/v4/core/movement-method-plugin.md',
|
'/docs/v4/core/movement-method-plugin.md',
|
||||||
'/docs/v4/core/render-props.md'
|
'/docs/v4/core/render-props.md',
|
||||||
|
'/docs/v4/core/text-setter.md'
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
'/docs/v4/ext-latex/',
|
'/docs/v4/ext-latex/',
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
# Configuration
|
# Configuration
|
||||||
|
|
||||||
|
<LegacyWarning />
|
||||||
|
|
||||||
`MarkwonConfiguration` class holds common Markwon functionality.
|
`MarkwonConfiguration` class holds common Markwon functionality.
|
||||||
These are _configurable_ properties:
|
These are _configurable_ properties:
|
||||||
* `SyntaxHighlight`
|
* `SyntaxHighlight`
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
# Core plugin <Badge text="3.0.0" />
|
# Core plugin <Badge text="3.0.0" />
|
||||||
|
|
||||||
|
<LegacyWarning />
|
||||||
|
|
||||||
Since <Badge text="3.0.0" /> with introduction of _plugins_, Markwon
|
Since <Badge text="3.0.0" /> with introduction of _plugins_, Markwon
|
||||||
**core** functionality was moved to a dedicated plugin.
|
**core** functionality was moved to a dedicated plugin.
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
# Getting started
|
# Getting started
|
||||||
|
|
||||||
|
<LegacyWarning />
|
||||||
|
|
||||||
:::tip Installation
|
:::tip Installation
|
||||||
Please follow [installation](/docs/v3/install.md) instructions
|
Please follow [installation](/docs/v3/install.md) instructions
|
||||||
to learn how to add `Markwon` to your project
|
to learn how to add `Markwon` to your project
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
# HTML Renderer
|
# HTML Renderer
|
||||||
|
|
||||||
|
<LegacyWarning />
|
||||||
|
|
||||||
Starting with <Badge text="3.0.0" /> `MarkwonHtmlRenderer` controls how HTML
|
Starting with <Badge text="3.0.0" /> `MarkwonHtmlRenderer` controls how HTML
|
||||||
is rendered:
|
is rendered:
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
# Images
|
# Images
|
||||||
|
|
||||||
|
<LegacyWarning />
|
||||||
|
|
||||||
Starting with <Badge text="3.0.0" /> `Markwon` comes with `ImagesPlugin`
|
Starting with <Badge text="3.0.0" /> `Markwon` comes with `ImagesPlugin`
|
||||||
which supports `http(s)`, `file` and `data` schemes and default media
|
which supports `http(s)`, `file` and `data` schemes and default media
|
||||||
decoder (for simple images, no [SVG](/docs/v3/image/svg.md) or [GIF](/docs/v3/image/gif.md) which
|
decoder (for simple images, no [SVG](/docs/v3/image/svg.md) or [GIF](/docs/v3/image/gif.md) which
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
# Movement method plugin
|
# Movement method plugin
|
||||||
|
|
||||||
|
<LegacyWarning />
|
||||||
|
|
||||||
`MovementMethodPlugin` can be used to apply a `MovementMethod` to a TextView
|
`MovementMethodPlugin` can be used to apply a `MovementMethod` to a TextView
|
||||||
(important if you have links inside your markdown). By default `CorePlugin`
|
(important if you have links inside your markdown). By default `CorePlugin`
|
||||||
will set a `LinkMovementMethod` on a TextView if one is missing. If you have
|
will set a `LinkMovementMethod` on a TextView if one is missing. If you have
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
# Plugins <Badge text="3.0.0" />
|
# Plugins <Badge text="3.0.0" />
|
||||||
|
|
||||||
|
<LegacyWarning />
|
||||||
|
|
||||||
Since <Badge text="3.0.0" /> `MarkwonPlugin` takes the key role in
|
Since <Badge text="3.0.0" /> `MarkwonPlugin` takes the key role in
|
||||||
processing and rendering markdown. Even **core** functionaly is abstracted
|
processing and rendering markdown. Even **core** functionaly is abstracted
|
||||||
into a `CorePlugin`. So it's still possible to use `Markwon` with a completely
|
into a `CorePlugin`. So it's still possible to use `Markwon` with a completely
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
# RenderProps <Badge text="3.0.0" />
|
# RenderProps <Badge text="3.0.0" />
|
||||||
|
|
||||||
|
<LegacyWarning />
|
||||||
|
|
||||||
`RenderProps` encapsulates passing arguments from a node visitor to a node renderer.
|
`RenderProps` encapsulates passing arguments from a node visitor to a node renderer.
|
||||||
Without hardcoding arguments into an API method calls.
|
Without hardcoding arguments into an API method calls.
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
# Spans Factory
|
# Spans Factory
|
||||||
|
|
||||||
|
<LegacyWarning />
|
||||||
|
|
||||||
Starting with <Badge text="3.0.0" /> `MarkwonSpansFactory` controls what spans are displayed
|
Starting with <Badge text="3.0.0" /> `MarkwonSpansFactory` controls what spans are displayed
|
||||||
for markdown nodes.
|
for markdown nodes.
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
# Theme
|
# Theme
|
||||||
|
|
||||||
|
<LegacyWarning />
|
||||||
|
|
||||||
Here is the list of properties that can be configured via `MarkwonTheme.Builder` class.
|
Here is the list of properties that can be configured via `MarkwonTheme.Builder` class.
|
||||||
|
|
||||||
:::tip
|
:::tip
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
# Visitor
|
# Visitor
|
||||||
|
|
||||||
|
<LegacyWarning />
|
||||||
|
|
||||||
Starting with <Badge text="3.0.0" /> _visiting_ of parsed markdown
|
Starting with <Badge text="3.0.0" /> _visiting_ of parsed markdown
|
||||||
nodes does not require creating own instance of commonmark-java `Visitor`,
|
nodes does not require creating own instance of commonmark-java `Visitor`,
|
||||||
instead a composable/configurable `MarkwonVisitor` is used.
|
instead a composable/configurable `MarkwonVisitor` is used.
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
# LaTeX extension
|
# LaTeX extension
|
||||||
|
|
||||||
|
<LegacyWarning />
|
||||||
|
|
||||||
<MavenBadge :artifact="'ext-latex'" />
|
<MavenBadge :artifact="'ext-latex'" />
|
||||||
|
|
||||||
This is an extension that will help you display LaTeX formulas in your markdown.
|
This is an extension that will help you display LaTeX formulas in your markdown.
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
# Strikethrough extension
|
# Strikethrough extension
|
||||||
|
|
||||||
|
<LegacyWarning />
|
||||||
|
|
||||||
<MavenBadge :artifact="'ext-strikethrough'" />
|
<MavenBadge :artifact="'ext-strikethrough'" />
|
||||||
|
|
||||||
This module adds `strikethrough` functionality to `Markwon` via `StrikethroughPlugin`:
|
This module adds `strikethrough` functionality to `Markwon` via `StrikethroughPlugin`:
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
# Tables extension
|
# Tables extension
|
||||||
|
|
||||||
|
<LegacyWarning />
|
||||||
|
|
||||||
<MavenBadge :artifact="'ext-tables'" />
|
<MavenBadge :artifact="'ext-tables'" />
|
||||||
|
|
||||||
This extension adds support for GFM tables.
|
This extension adds support for GFM tables.
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
# Task list extension
|
# Task list extension
|
||||||
|
|
||||||
|
<LegacyWarning />
|
||||||
|
|
||||||
<MavenBadge :artifact="'ext-tasklist'" />
|
<MavenBadge :artifact="'ext-tasklist'" />
|
||||||
|
|
||||||
Adds support for GFM (Github-flavored markdown) task-lists:
|
Adds support for GFM (Github-flavored markdown) task-lists:
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
# HTML
|
# HTML
|
||||||
|
|
||||||
|
<LegacyWarning />
|
||||||
|
|
||||||
This artifact encapsulates HTML parsing from the core artifact and provides
|
This artifact encapsulates HTML parsing from the core artifact and provides
|
||||||
few predefined `TagHandlers`
|
few predefined `TagHandlers`
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
# Image GIF
|
# Image GIF
|
||||||
|
|
||||||
|
<LegacyWarning />
|
||||||
|
|
||||||
<MavenBadge :artifact="'image-gif'" />
|
<MavenBadge :artifact="'image-gif'" />
|
||||||
|
|
||||||
Adds support for GIF images inside markdown.
|
Adds support for GIF images inside markdown.
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
# Image OkHttp
|
# Image OkHttp
|
||||||
|
|
||||||
|
<LegacyWarning />
|
||||||
|
|
||||||
<MavenBadge :artifact="'image-okhttp'" />
|
<MavenBadge :artifact="'image-okhttp'" />
|
||||||
|
|
||||||
Uses [okhttp library](https://github.com/square/okhttp) as the network transport fro images. Since <Badge text="3.0.0" />
|
Uses [okhttp library](https://github.com/square/okhttp) as the network transport fro images. Since <Badge text="3.0.0" />
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
# Image SVG
|
# Image SVG
|
||||||
|
|
||||||
|
<LegacyWarning />
|
||||||
|
|
||||||
<MavenBadge :artifact="'image-svg'" />
|
<MavenBadge :artifact="'image-svg'" />
|
||||||
|
|
||||||
Adds support for SVG images inside markdown.
|
Adds support for SVG images inside markdown.
|
||||||
|
@ -3,6 +3,8 @@ prev: false
|
|||||||
next: /docs/v3/core/getting-started.md
|
next: /docs/v3/core/getting-started.md
|
||||||
---
|
---
|
||||||
|
|
||||||
|
<LegacyWarning />
|
||||||
|
|
||||||
# Installation
|
# Installation
|
||||||
|
|
||||||

|

|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
# Migration 2.x.x -> 3.x.x
|
# Migration 2.x.x -> 3.x.x
|
||||||
|
|
||||||
|
<LegacyWarning />
|
||||||
|
|
||||||
* strikethrough moved to standalone module
|
* strikethrough moved to standalone module
|
||||||
* tables moved to standalone module
|
* tables moved to standalone module
|
||||||
* core functionality of `AsyncDrawableLoader` moved to `core` module
|
* core functionality of `AsyncDrawableLoader` moved to `core` module
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
# Recycler Table <Badge text="3.0.0" />
|
# Recycler Table <Badge text="3.0.0" />
|
||||||
|
|
||||||
|
<LegacyWarning />
|
||||||
|
|
||||||
<MavenBadge :artifact="'recycler-table'" />
|
<MavenBadge :artifact="'recycler-table'" />
|
||||||
|
|
||||||
Artifact that provides [MarkwonAdapter.Entry](/docs/v3/recycler/) to render `TableBlock` inside
|
Artifact that provides [MarkwonAdapter.Entry](/docs/v3/recycler/) to render `TableBlock` inside
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
# Recycler <Badge text="3.0.0" />
|
# Recycler <Badge text="3.0.0" />
|
||||||
|
|
||||||
|
<LegacyWarning />
|
||||||
|
|
||||||
<MavenBadge :artifact="'recycler'" />
|
<MavenBadge :artifact="'recycler'" />
|
||||||
|
|
||||||
This artifact allows displaying markdown in a set of Android widgets
|
This artifact allows displaying markdown in a set of Android widgets
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
# Syntax highlight
|
# Syntax highlight
|
||||||
|
|
||||||
|
<LegacyWarning />
|
||||||
|
|
||||||
<MavenBadge :artifact="'syntax-highlight'" />
|
<MavenBadge :artifact="'syntax-highlight'" />
|
||||||
|
|
||||||
This is a simple module to add **syntax highlight** functionality to your markdown rendered with `Markwon` library. It is based on [Prism4j](https://github.com/noties/Prism4j) so lead there to understand how to configure `Prism4j` instance.
|
This is a simple module to add **syntax highlight** functionality to your markdown rendered with `Markwon` library. It is based on [Prism4j](https://github.com/noties/Prism4j) so lead there to understand how to configure `Prism4j` instance.
|
||||||
|
40
docs/docs/v4/core/text-setter.md
Normal file
40
docs/docs/v4/core/text-setter.md
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
# TextSetter <Badge text="4.1.0" />
|
||||||
|
|
||||||
|
Since <Badge text="4.1.0" /> it is possible to control how text is applied to a `TextView`.
|
||||||
|
This is done via `Markwon.TextSetter` interface.
|
||||||
|
|
||||||
|
```java
|
||||||
|
final Markwon markwon = Markwon.builder(context)
|
||||||
|
.usePlugin(/**/)
|
||||||
|
.textSetter(PrecomputedTextSetterCompat.create(Executors.newCachedThreadPool()))
|
||||||
|
.build();
|
||||||
|
```
|
||||||
|
|
||||||
|
```java
|
||||||
|
public interface TextSetter {
|
||||||
|
/**
|
||||||
|
* @param textView TextView
|
||||||
|
* @param markdown prepared markdown
|
||||||
|
* @param bufferType BufferType specified when building {@link Markwon} instance
|
||||||
|
* via {@link Builder#bufferType(TextView.BufferType)}
|
||||||
|
* @param onComplete action to run when set-text is finished (required to call in order
|
||||||
|
* to execute {@link MarkwonPlugin#afterSetText(TextView)})
|
||||||
|
*/
|
||||||
|
void setText(
|
||||||
|
@NonNull TextView textView,
|
||||||
|
@NonNull Spanned markdown,
|
||||||
|
@NonNull TextView.BufferType bufferType,
|
||||||
|
@NonNull Runnable onComplete);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Primary target for this functionality is to use [PrecomputedText] and [PrecomputedTextCompat].
|
||||||
|
`Markwon` comes with `PrecomputedTextSetterCompat` implementation.
|
||||||
|
|
||||||
|
:::tip Note
|
||||||
|
Please note that `PrecomputedTextCompat` belongs to the `androidx.core:core` artifact. Make
|
||||||
|
sure that you have it in your project's dependencies (explicitly or implicitly)
|
||||||
|
:::
|
||||||
|
|
||||||
|
[PrecomputedText]: https://developer.android.com/reference/android/text/PrecomputedText
|
||||||
|
[PrecomputedTextCompat]: https://developer.android.com/reference/androidx/core/text/PrecomputedTextCompat
|
@ -141,21 +141,21 @@ public abstract class Markwon {
|
|||||||
* @see PrecomputedTextSetterCompat
|
* @see PrecomputedTextSetterCompat
|
||||||
* @since 4.1.0
|
* @since 4.1.0
|
||||||
*/
|
*/
|
||||||
public interface TextSetter {
|
public interface TextSetter {
|
||||||
/**
|
/**
|
||||||
* @param textView TextView
|
* @param textView TextView
|
||||||
* @param markdown prepared markdown
|
* @param markdown prepared markdown
|
||||||
* @param bufferType BufferType specified when building {@link Markwon} instance
|
* @param bufferType BufferType specified when building {@link Markwon} instance
|
||||||
* via {@link Builder#bufferType(TextView.BufferType)}
|
* via {@link Builder#bufferType(TextView.BufferType)}
|
||||||
* @param onComplete action to run when set-text is finished (required to call in order
|
* @param onComplete action to run when set-text is finished (required to call in order
|
||||||
* to execute {@link MarkwonPlugin#afterSetText(TextView)})
|
* to execute {@link MarkwonPlugin#afterSetText(TextView)})
|
||||||
*/
|
*/
|
||||||
void setText(
|
void setText(
|
||||||
@NonNull TextView textView,
|
@NonNull TextView textView,
|
||||||
@NonNull Spanned markdown,
|
@NonNull Spanned markdown,
|
||||||
@NonNull TextView.BufferType bufferType,
|
@NonNull TextView.BufferType bufferType,
|
||||||
@NonNull Runnable onComplete);
|
@NonNull Runnable onComplete);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builder for {@link Markwon}.
|
* Builder for {@link Markwon}.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user