Update documentation web-site

This commit is contained in:
Dimitry Ivanov 2019-08-06 19:27:20 +03:00
parent 3fe514aeea
commit 6c8f1c04bb
29 changed files with 124 additions and 20 deletions

View File

@ -10,6 +10,7 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import javax.inject.Inject;
@ -18,6 +19,7 @@ import io.noties.debug.Debug;
import io.noties.markwon.AbstractMarkwonPlugin;
import io.noties.markwon.Markwon;
import io.noties.markwon.MarkwonConfiguration;
import io.noties.markwon.PrecomputedTextSetterCompat;
import io.noties.markwon.app.gif.GifAwarePlugin;
import io.noties.markwon.ext.strikethrough.StrikethroughPlugin;
import io.noties.markwon.ext.tables.TablePlugin;
@ -73,6 +75,11 @@ public class MarkdownRenderer {
cancel();
final Markwon markwon = Markwon.builder(context)
.usePlugin(/**/)
.textSetter(PrecomputedTextSetterCompat.create(Executors.newCachedThreadPool()))
.build();
task = service.submit(new Runnable() {
@Override

View File

@ -1,7 +1,7 @@
<template>
<div class="warning custom-block">
<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>
</template>

View File

@ -16,9 +16,17 @@ module.exports = {
{
text: 'API Version',
items: [
{ text: 'Current (4.x.x)', link: '/' },
{ text: 'Legacy (3.x.x)', link: '/docs/v3/install.md' },
{ text: 'Legacy (2.x.x)', link: '/docs/v2/' }
{
text: 'Latest', items: [
{ 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' },
@ -83,7 +91,8 @@ module.exports = {
'/docs/v4/core/spans-factory.md',
'/docs/v4/core/core-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/',

View File

@ -1,5 +1,7 @@
# Configuration
<LegacyWarning />
`MarkwonConfiguration` class holds common Markwon functionality.
These are _configurable_ properties:
* `SyntaxHighlight`

View File

@ -1,5 +1,7 @@
# Core plugin <Badge text="3.0.0" />
<LegacyWarning />
Since <Badge text="3.0.0" /> with introduction of _plugins_, Markwon
**core** functionality was moved to a dedicated plugin.

View File

@ -1,5 +1,7 @@
# Getting started
<LegacyWarning />
:::tip Installation
Please follow [installation](/docs/v3/install.md) instructions
to learn how to add `Markwon` to your project

View File

@ -1,5 +1,7 @@
# HTML Renderer
<LegacyWarning />
Starting with <Badge text="3.0.0" /> `MarkwonHtmlRenderer` controls how HTML
is rendered:

View File

@ -1,5 +1,7 @@
# Images
<LegacyWarning />
Starting with <Badge text="3.0.0" /> `Markwon` comes with `ImagesPlugin`
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

View File

@ -1,5 +1,7 @@
# Movement method plugin
<LegacyWarning />
`MovementMethodPlugin` can be used to apply a `MovementMethod` to a TextView
(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

View File

@ -1,5 +1,7 @@
# Plugins <Badge text="3.0.0" />
<LegacyWarning />
Since <Badge text="3.0.0" /> `MarkwonPlugin` takes the key role in
processing and rendering markdown. Even **core** functionaly is abstracted
into a `CorePlugin`. So it's still possible to use `Markwon` with a completely

View File

@ -1,5 +1,7 @@
# RenderProps <Badge text="3.0.0" />
<LegacyWarning />
`RenderProps` encapsulates passing arguments from a node visitor to a node renderer.
Without hardcoding arguments into an API method calls.

View File

@ -1,5 +1,7 @@
# Spans Factory
<LegacyWarning />
Starting with <Badge text="3.0.0" /> `MarkwonSpansFactory` controls what spans are displayed
for markdown nodes.

View File

@ -1,5 +1,7 @@
# Theme
<LegacyWarning />
Here is the list of properties that can be configured via `MarkwonTheme.Builder` class.
:::tip

View File

@ -1,5 +1,7 @@
# Visitor
<LegacyWarning />
Starting with <Badge text="3.0.0" /> _visiting_ of parsed markdown
nodes does not require creating own instance of commonmark-java `Visitor`,
instead a composable/configurable `MarkwonVisitor` is used.

View File

@ -1,5 +1,7 @@
# LaTeX extension
<LegacyWarning />
<MavenBadge :artifact="'ext-latex'" />
This is an extension that will help you display LaTeX formulas in your markdown.

View File

@ -1,5 +1,7 @@
# Strikethrough extension
<LegacyWarning />
<MavenBadge :artifact="'ext-strikethrough'" />
This module adds `strikethrough` functionality to `Markwon` via `StrikethroughPlugin`:

View File

@ -1,5 +1,7 @@
# Tables extension
<LegacyWarning />
<MavenBadge :artifact="'ext-tables'" />
This extension adds support for GFM tables.

View File

@ -1,5 +1,7 @@
# Task list extension
<LegacyWarning />
<MavenBadge :artifact="'ext-tasklist'" />
Adds support for GFM (Github-flavored markdown) task-lists:

View File

@ -1,5 +1,7 @@
# HTML
<LegacyWarning />
This artifact encapsulates HTML parsing from the core artifact and provides
few predefined `TagHandlers`

View File

@ -1,5 +1,7 @@
# Image GIF
<LegacyWarning />
<MavenBadge :artifact="'image-gif'" />
Adds support for GIF images inside markdown.

View File

@ -1,5 +1,7 @@
# Image OkHttp
<LegacyWarning />
<MavenBadge :artifact="'image-okhttp'" />
Uses [okhttp library](https://github.com/square/okhttp) as the network transport fro images. Since <Badge text="3.0.0" />

View File

@ -1,5 +1,7 @@
# Image SVG
<LegacyWarning />
<MavenBadge :artifact="'image-svg'" />
Adds support for SVG images inside markdown.

View File

@ -3,6 +3,8 @@ prev: false
next: /docs/v3/core/getting-started.md
---
<LegacyWarning />
# Installation
![stable](https://img.shields.io/maven-central/v/ru.noties.markwon/core.svg?label=stable)

View File

@ -1,5 +1,7 @@
# Migration 2.x.x -> 3.x.x
<LegacyWarning />
* strikethrough moved to standalone module
* tables moved to standalone module
* core functionality of `AsyncDrawableLoader` moved to `core` module

View File

@ -1,5 +1,7 @@
# Recycler Table <Badge text="3.0.0" />
<LegacyWarning />
<MavenBadge :artifact="'recycler-table'" />
Artifact that provides [MarkwonAdapter.Entry](/docs/v3/recycler/) to render `TableBlock` inside

View File

@ -1,5 +1,7 @@
# Recycler <Badge text="3.0.0" />
<LegacyWarning />
<MavenBadge :artifact="'recycler'" />
This artifact allows displaying markdown in a set of Android widgets

View File

@ -1,5 +1,7 @@
# Syntax highlight
<LegacyWarning />
<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.

View 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

View File

@ -141,21 +141,21 @@ public abstract class Markwon {
* @see PrecomputedTextSetterCompat
* @since 4.1.0
*/
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);
}
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);
}
/**
* Builder for {@link Markwon}.