Publish upcoming beta documentation
This commit is contained in:
parent
96ca96fa70
commit
a3ee7549a7
@ -4,7 +4,7 @@ buildscript {
|
|||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:3.2.1'
|
classpath 'com.android.tools.build:gradle:3.3.1'
|
||||||
classpath 'com.github.ben-manes:gradle-versions-plugin:0.20.0'
|
classpath 'com.github.ben-manes:gradle-versions-plugin:0.20.0'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,62 +17,61 @@ module.exports = {
|
|||||||
{
|
{
|
||||||
text: 'API Version',
|
text: 'API Version',
|
||||||
items: [
|
items: [
|
||||||
{ text: 'Current (3.x.x)', link: '/' },
|
{ text: 'Current (2.x.x)', link: '/' },
|
||||||
{ text: 'Legacy (2.x.x)', link: '/docs/v2/' }
|
{ text: 'BETA (3.x.x)', link: '/docs/v3/' }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{ text: 'Sandbox', link: '/sandbox.md' },
|
{ text: 'Sandbox', link: '/sandbox.md' },
|
||||||
{ text: 'Donate', link: '/donate.md' },
|
|
||||||
{ text: 'Github', link: 'https://github.com/noties/Markwon' }
|
{ text: 'Github', link: 'https://github.com/noties/Markwon' }
|
||||||
],
|
],
|
||||||
sidebar: {
|
sidebar: {
|
||||||
'/docs/v2/': [
|
'/docs/v3/': [
|
||||||
'',
|
|
||||||
'getting-started.md',
|
|
||||||
'configure.md',
|
|
||||||
'theme.md',
|
|
||||||
'factory.md',
|
|
||||||
'image-loader.md',
|
|
||||||
'syntax-highlight.md',
|
|
||||||
'html.md',
|
|
||||||
'view.md'
|
|
||||||
],
|
|
||||||
'/': [
|
|
||||||
'',
|
'',
|
||||||
{
|
{
|
||||||
title: 'Core',
|
title: 'Core',
|
||||||
collapsable: false,
|
collapsable: false,
|
||||||
children: [
|
children: [
|
||||||
'/docs/core/getting-started.md',
|
'/docs/v3/core/getting-started.md',
|
||||||
'/docs/core/plugins.md',
|
'/docs/v3/core/plugins.md',
|
||||||
'/docs/core/theme.md',
|
'/docs/v3/core/theme.md',
|
||||||
'/docs/core/images.md',
|
'/docs/v3/core/images.md',
|
||||||
'/docs/core/configuration.md',
|
'/docs/v3/core/configuration.md',
|
||||||
'/docs/core/visitor.md',
|
'/docs/v3/core/visitor.md',
|
||||||
'/docs/core/spans-factory.md',
|
'/docs/v3/core/spans-factory.md',
|
||||||
'/docs/core/html-renderer.md',
|
'/docs/v3/core/html-renderer.md',
|
||||||
'/docs/core/core-plugin.md',
|
'/docs/v3/core/core-plugin.md',
|
||||||
'/docs/core/movement-method-plugin.md'
|
'/docs/v3/core/movement-method-plugin.md'
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
'/docs/ext-latex/',
|
'/docs/v3/ext-latex/',
|
||||||
'/docs/ext-strikethrough/',
|
'/docs/v3/ext-strikethrough/',
|
||||||
'/docs/ext-tables/',
|
'/docs/v3/ext-tables/',
|
||||||
'/docs/ext-tasklist/',
|
'/docs/v3/ext-tasklist/',
|
||||||
{
|
{
|
||||||
title: 'HTML',
|
title: 'HTML',
|
||||||
collapsable: false,
|
collapsable: false,
|
||||||
children: [
|
children: [
|
||||||
'/docs/html/',
|
'/docs/v3/html/',
|
||||||
'/docs/html/custom-tag-handler.md'
|
'/docs/v3/html/custom-tag-handler.md'
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
'/docs/image/gif.md',
|
'/docs/v3/image/gif.md',
|
||||||
'/docs/image/okhttp.md',
|
'/docs/v3/image/okhttp.md',
|
||||||
'/docs/image/svg.md',
|
'/docs/v3/image/svg.md',
|
||||||
'/docs/recycler/',
|
'/docs/v3/recycler/',
|
||||||
'/docs/syntax-highlight/',
|
'/docs/v3/syntax-highlight/',
|
||||||
'/docs/migration-2-3.md'
|
'/docs/v3/migration-2-3.md'
|
||||||
|
],
|
||||||
|
'/': [
|
||||||
|
'',
|
||||||
|
'/docs/getting-started.md',
|
||||||
|
'/docs/configure.md',
|
||||||
|
'/docs/theme.md',
|
||||||
|
'/docs/factory.md',
|
||||||
|
'/docs/image-loader.md',
|
||||||
|
'/docs/syntax-highlight.md',
|
||||||
|
'/docs/html.md',
|
||||||
|
'/docs/view.md'
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
sidebarDepth: 2,
|
sidebarDepth: 2,
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
---
|
---
|
||||||
title: 'Introduction'
|
title: 'Overview'
|
||||||
---
|
---
|
||||||
|
|
||||||
<img :src="$withBase('./art/markwon_logo.png')" alt="Markwon Logo" width="50%">
|
<img :src="$withBase('./art/markwon_logo.png')" alt="Markwon Logo" width="50%">
|
||||||
|
|
||||||
<br><br>
|
<br><br>
|
||||||
[](http://search.maven.org/#search|ga|1|g%3A%22ru.noties.markwon%22%20)
|
<MavenBadges2xx/>
|
||||||
[](https://travis-ci.org/noties/Markwon)
|
|
||||||
|
|
||||||
**Markwon** is a markdown library for Android. It parses markdown following
|
**Markwon** is a markdown library for Android. It parses markdown following
|
||||||
<Link name="commonmark-spec" /> with the help of amazing <Link name="commonmark-java" /> library
|
<Link name="commonmark-spec" /> with the help of amazing <Link name="commonmark-java" /> library
|
||||||
@ -21,23 +20,22 @@ but also gives all the means to tweak the appearance if desired. All markdown fe
|
|||||||
listed in <Link name="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:
|
||||||
|
|
||||||
* Emphasis (`*`, `_`)
|
* Emphasis (`*`, `_`)
|
||||||
* Strong emphasis (`**`, `__`)
|
* Strong emphasis (`**`, `__`)
|
||||||
|
* Strike-through (`~~`)
|
||||||
* Headers (`#{1,6}`)
|
* Headers (`#{1,6}`)
|
||||||
* Links (`[]()` && `[][]`)
|
* Links (`[]()` && `[][]`)
|
||||||
* [Images](/docs/core/images.md)
|
* [Images](/docs/image-loader.md)
|
||||||
* Thematic break (`---`, `***`, `___`)
|
* Thematic break (`---`, `***`, `___`)
|
||||||
* Quotes & nested quotes (`>{1,}`)
|
* Quotes & nested quotes (`>{1,}`)
|
||||||
* Ordered & non-ordered lists & nested ones
|
* Ordered & non-ordered lists & nested ones
|
||||||
* Inline code
|
* Inline code
|
||||||
* Code blocks
|
* Code blocks
|
||||||
* [Strike-through](/docs/ext-strikethrough/) (`~~`)
|
* Tables (*with limitations*)
|
||||||
* [Tables](/docs/ext-tables/) (*with limitations*)
|
* [Syntax highlight](/docs/syntax-highlight.md)
|
||||||
* [Syntax highlight](/docs/syntax-highlight/)
|
* [HTML](/docs/html.md)
|
||||||
* [LaTeX](/docs/ext-latex/) formulas
|
|
||||||
* [HTML](/docs/html/)
|
|
||||||
* Emphasis (`<i>`, `<em>`, `<cite>`, `<dfn>`)
|
* Emphasis (`<i>`, `<em>`, `<cite>`, `<dfn>`)
|
||||||
* Strong emphasis (`<b>`, `<strong>`)
|
* Strong emphasis (`<b>`, `<strong>`)
|
||||||
* SuperScript (`<sup>`)
|
* SuperScript (`<sup>`)
|
||||||
@ -50,8 +48,8 @@ listed in <Link name="commonmark-spec" /> are supported (including support for *
|
|||||||
* Blockquote (`blockquote`)
|
* Blockquote (`blockquote`)
|
||||||
* Heading (`h1`, `h2`, `h3`, `h4`, `h5`, `h6`)
|
* Heading (`h1`, `h2`, `h3`, `h4`, `h5`, `h6`)
|
||||||
* there is support to render any HTML tag, but it will require to create a special `TagHandler`,
|
* there is support to render any HTML tag, but it will require to create a special `TagHandler`,
|
||||||
more information can be found in [HTML section](/docs/html/custom-tag-handler.md)
|
more information can be found in [HTML section](/docs/html.md#custom-tag-handler)
|
||||||
* [Task lists](/docs/ext-tasklist/):
|
* Task lists:
|
||||||
- [ ] Not _done_
|
- [ ] Not _done_
|
||||||
- [X] **Done** with `X`
|
- [X] **Done** with `X`
|
||||||
- [x] ~~and~~ **or** small `x`
|
- [x] ~~and~~ **or** small `x`
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
<LegacyWarning />
|
|
||||||
|
|
||||||
# Configuration
|
# Configuration
|
||||||
|
|
||||||
`SpannableConfiguration` is the core component that controls how markdown is parsed and rendered.
|
`SpannableConfiguration` is the core component that controls how markdown is parsed and rendered.
|
||||||
@ -26,13 +24,13 @@ values as they will be applied automatically
|
|||||||
If you plan on using images inside your markdown/HTML, you will have to **explicitly**
|
If you plan on using images inside your markdown/HTML, you will have to **explicitly**
|
||||||
register an implementation of `AsyncDrawable.Loader` via `#asyncDrawableLoader` builder method.
|
register an implementation of `AsyncDrawable.Loader` via `#asyncDrawableLoader` builder method.
|
||||||
`Markwon` comes with ready implementation for that and it can be found in
|
`Markwon` comes with ready implementation for that and it can be found in
|
||||||
`markwon-image-loader` module. Refer to module [documentation](/docs/v2/image-loader.md)
|
`markwon-image-loader` module. Refer to module [documentation](/docs/image-loader.md)
|
||||||
:::
|
:::
|
||||||
|
|
||||||
## Theme
|
## Theme
|
||||||
|
|
||||||
`SpannableTheme` controls how markdown is rendered. It has pretty extensive number of
|
`SpannableTheme` controls how markdown is rendered. It has pretty extensive number of
|
||||||
options that can be found [here](/docs/v2/theme.md)
|
options that can be found [here](/docs/theme.md)
|
||||||
|
|
||||||
```java
|
```java
|
||||||
SpannableConfiguration.builder(context)
|
SpannableConfiguration.builder(context)
|
||||||
@ -58,7 +56,7 @@ If `AsyncDrawable.Loader` is not provided explicitly, default **no-op** implemen
|
|||||||
|
|
||||||
:::tip Implementation
|
:::tip Implementation
|
||||||
There are no restrictions on what implementation to use, but `Markwon` has artifact that can
|
There are no restrictions on what implementation to use, but `Markwon` has artifact that can
|
||||||
answer the most common needs of displaying SVG, GIF and other image formats. It can be found [here](/docs/v2/image-loader.md)
|
answer the most common needs of displaying SVG, GIF and other image formats. It can be found [here](/docs/image-loader.md)
|
||||||
:::
|
:::
|
||||||
|
|
||||||
### Size resolver <Badge text="1.0.1" />
|
### Size resolver <Badge text="1.0.1" />
|
||||||
@ -109,7 +107,7 @@ If not provided explicitly, default **no-op** implementation will be used.
|
|||||||
Although `SyntaxHighlight` interface was included with the very first version
|
Although `SyntaxHighlight` interface was included with the very first version
|
||||||
of `Markwon` there were no ready-to-use implementations. But starting with <Badge text="1.1.0" />
|
of `Markwon` there were no ready-to-use implementations. But starting with <Badge text="1.1.0" />
|
||||||
`Markwon` provides one. It can be found in `markwon-syntax-highlight` artifact. Refer
|
`Markwon` provides one. It can be found in `markwon-syntax-highlight` artifact. Refer
|
||||||
to module [documentation](/docs/v2/syntax-highlight.md)
|
to module [documentation](/docs/syntax-highlight.md)
|
||||||
:::
|
:::
|
||||||
|
|
||||||
## Link resolver
|
## Link resolver
|
||||||
@ -168,7 +166,7 @@ SpannableConfiguration.builder(context)
|
|||||||
```
|
```
|
||||||
|
|
||||||
If not provided explicitly, default `SpannableFactoryDef` implementation will be used. It is documented
|
If not provided explicitly, default `SpannableFactoryDef` implementation will be used. It is documented
|
||||||
in [this section](/docs/v2/factory.md)
|
in [this section](/docs/factory.md)
|
||||||
|
|
||||||
## Soft line break <Badge text="1.1.1" />
|
## Soft line break <Badge text="1.1.1" />
|
||||||
|
|
||||||
@ -199,7 +197,7 @@ SpannableConfiguration.builder(context)
|
|||||||
|
|
||||||
if not provided explicitly, default `MarkwonHtmlParserImpl` will be used
|
if not provided explicitly, default `MarkwonHtmlParserImpl` will be used
|
||||||
**if** it can be found in classpath, otherwise default **no-op** implementation
|
**if** it can be found in classpath, otherwise default **no-op** implementation
|
||||||
wiil be used. Refer to [HTML](/docs/v2/html.md#parser) document for more information about this behavior.
|
wiil be used. Refer to [HTML](/docs/html.md#parser) document for more information about this behavior.
|
||||||
|
|
||||||
### Renderer
|
### Renderer
|
||||||
|
|
||||||
@ -212,7 +210,7 @@ SpannableConfiguration.builder(context)
|
|||||||
```
|
```
|
||||||
|
|
||||||
If not provided explicitly, default `MarkwonHtmlRenderer` implementation will be used.
|
If not provided explicitly, default `MarkwonHtmlRenderer` implementation will be used.
|
||||||
It is documented [here](/docs/v2/html.md#renderer)
|
It is documented [here](/docs/html.md#renderer)
|
||||||
|
|
||||||
### HTML allow non-closed tags
|
### HTML allow non-closed tags
|
||||||
|
|
@ -1,5 +1,3 @@
|
|||||||
<LegacyWarning />
|
|
||||||
|
|
||||||
# Factory <Badge text="1.1.0" />
|
# Factory <Badge text="1.1.0" />
|
||||||
|
|
||||||
`SpannableFactory` is used to create Span implementations.
|
`SpannableFactory` is used to create Span implementations.
|
@ -1,5 +1,3 @@
|
|||||||
<LegacyWarning />
|
|
||||||
|
|
||||||
# Getting started
|
# Getting started
|
||||||
|
|
||||||
## Quick one
|
## Quick one
|
||||||
@ -22,7 +20,7 @@ Toast.makeText(context, markdown, Toast.LENGTH_LONG).show();
|
|||||||
|
|
||||||
## Longer one
|
## Longer one
|
||||||
|
|
||||||
When you need to customize markdown parsing/rendering you can use [SpannableConfiguration](/docs/v2/configure.md):
|
When you need to customize markdown parsing/rendering you can use [SpannableConfiguration](/docs/configure.md):
|
||||||
|
|
||||||
```java
|
```java
|
||||||
final SpannableConfiguration configuration = SpannableConfiguration.builder(context)
|
final SpannableConfiguration configuration = SpannableConfiguration.builder(context)
|
@ -1,5 +1,3 @@
|
|||||||
<LegacyWarning />
|
|
||||||
|
|
||||||
# HTML <Badge text="2.0.0" />
|
# HTML <Badge text="2.0.0" />
|
||||||
|
|
||||||
Starting with version `2.0.0` `Markwon` brings the whole HTML parsing/rendering
|
Starting with version `2.0.0` `Markwon` brings the whole HTML parsing/rendering
|
@ -1,5 +1,3 @@
|
|||||||
<LegacyWarning />
|
|
||||||
|
|
||||||
# Images
|
# Images
|
||||||
|
|
||||||
By default `Markwon` doesn't handle images. Although `AsyncDrawable.Loader` is
|
By default `Markwon` doesn't handle images. Although `AsyncDrawable.Loader` is
|
||||||
@ -23,7 +21,7 @@ public interface Loader {
|
|||||||
`AsyncDrawableLoader` from `markwon-image-loader` artifact can be used.
|
`AsyncDrawableLoader` from `markwon-image-loader` artifact can be used.
|
||||||
|
|
||||||
:::tip Install
|
:::tip Install
|
||||||
[Learn how to add](/docs/v2/README.md#image-loader) `markwon-image-loader` to your project
|
[Learn how to add](/docs/install.md#image-loader) `markwon-image-loader` to your project
|
||||||
:::
|
:::
|
||||||
|
|
||||||
Default instance of `AsyncDrawableLoader` can be obtain like this:
|
Default instance of `AsyncDrawableLoader` can be obtain like this:
|
@ -1,73 +1,89 @@
|
|||||||
---
|
---
|
||||||
prev: false
|
prev: false
|
||||||
next: /docs/core/getting-started.md
|
next: /docs/getting-started.md
|
||||||
---
|
---
|
||||||
|
|
||||||
# Installation
|
# Installation
|
||||||
|
|
||||||

|
<MavenBadges2xx />
|
||||||

|
|
||||||
|
|
||||||
<ArtifactPicker />
|
In order to start using `Markwon` add this to your dependencies block
|
||||||
|
in your projects `build.gradle`:
|
||||||
# Bundle <Badge text="3.0.0" />
|
|
||||||
If you wish to include all Markwon artifacts or add specific artifacts
|
|
||||||
in a different manner than explicit gradle dependency definition, you can
|
|
||||||
use `markwon-bundle.gradle` gradle script:
|
|
||||||
|
|
||||||
*(in your `build.gradle`)*
|
|
||||||
```groovy
|
|
||||||
apply plugin: 'com.android.application'
|
|
||||||
apply from: 'https://raw.githubusercontent.com/noties/Markwon/master/markwon-bundle.gradle'
|
|
||||||
|
|
||||||
android { /* */ }
|
|
||||||
|
|
||||||
ext.markwon = [
|
|
||||||
'version': '3.0.0',
|
|
||||||
'includeAll': true
|
|
||||||
]
|
|
||||||
|
|
||||||
dependencies { /* */ }
|
|
||||||
```
|
|
||||||
|
|
||||||
`markwon` object can have these properties:
|
|
||||||
* `version` - (required) version of `Markwon`
|
|
||||||
* `includeAll` - if _true_ will add all known Markwon artifacts. Can be used with `exclude`
|
|
||||||
* * `exclude` - an array of artifacts to _exclude_ (cannot exclude `core`)
|
|
||||||
* `artifacts` - an array of artifacts (can omit `core`, as it will be added implicitly anyway)
|
|
||||||
|
|
||||||
If `includeAll` property is present and is `true`, then `artifacts` property won't be used.
|
|
||||||
If there is no `includeAll` property or if it is `false`, `exclude` property won't be used.
|
|
||||||
|
|
||||||
These 2 markwon objects are equal:
|
|
||||||
|
|
||||||
```groovy
|
```groovy
|
||||||
// #1
|
implementation "ru.noties:markwon:${markwonVersion}"
|
||||||
ext.markwon = [
|
|
||||||
'version': '3.0.0',
|
|
||||||
'artifacts': [
|
|
||||||
'ext-latex',
|
|
||||||
'ext-strikethrough',
|
|
||||||
'ext-tables',
|
|
||||||
'ext-tasklist',
|
|
||||||
'html',
|
|
||||||
'image-gif',
|
|
||||||
'image-okhttp',
|
|
||||||
'image-svg',
|
|
||||||
'recycler',
|
|
||||||
'syntax-highlight'
|
|
||||||
]
|
|
||||||
]
|
|
||||||
|
|
||||||
// #2
|
|
||||||
ext.markwon = [
|
|
||||||
'version': '3.0.0',
|
|
||||||
'includeAll': true
|
|
||||||
]
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
This is core artifact that is sufficient to start displaying markdown in your Android applications.
|
||||||
|
|
||||||
|
`Markwon` comes with more artifacts that cover additional functionality, but they are
|
||||||
|
**not** required to be used, as most of them provide implementations for functionality
|
||||||
|
that is _interfaced_ in the core artifact
|
||||||
|
|
||||||
|
```groovy
|
||||||
|
implementation "ru.noties:markwon-image-loader:${markwonVersion}"
|
||||||
|
implementation "ru.noties:markwon-syntax-highlight:${markwonVersion}"
|
||||||
|
implementation "ru.noties:markwon-view:${markwonVersion}"
|
||||||
|
```
|
||||||
|
|
||||||
|
These artifacts share the same _version_ as the core artifact
|
||||||
|
|
||||||
|
### Image loader
|
||||||
|
|
||||||
|
```groovy
|
||||||
|
implementation "ru.noties:markwon-image-loader:${markwonVersion}"
|
||||||
|
```
|
||||||
|
|
||||||
|
Provides implementation of `AsyncDrawable.Loader` and comes with support for:
|
||||||
|
* SVG
|
||||||
|
* GIF
|
||||||
|
* Other image formats
|
||||||
|
|
||||||
|
Please refer to documentation for [image loader](/docs/image-loader.md) module
|
||||||
|
|
||||||
|
### Syntax highlight
|
||||||
|
|
||||||
|
```groovy
|
||||||
|
implementation "ru.noties:markwon-syntax-highlight:${markwonVersion}"
|
||||||
|
```
|
||||||
|
|
||||||
|
Provides implementation of `SyntaxHighlight` and allows various syntax highlighting
|
||||||
|
in your markdown based Android applications. Comes with 2 ready-to-be-used themes: `light` and `dark`.
|
||||||
|
Please refer to documentation for [syntax highlight](/docs/syntax-highlight.md) module
|
||||||
|
|
||||||
|
### View
|
||||||
|
|
||||||
|
```groovy
|
||||||
|
implementation "ru.noties:markwon-view:${markwonVersion}"
|
||||||
|
```
|
||||||
|
|
||||||
|
Provides 2 widgets to display markdown: `MarkwonView` and `MarkwonViewCompat` (subclasses
|
||||||
|
of `TextView` and `AppCompatTextView` respectively).
|
||||||
|
Please refer to documentation for [view](/docs/view.md) module
|
||||||
|
|
||||||
|
## Proguard
|
||||||
|
|
||||||
|
When using `markwon-image-loader` artifact and Proguard is enabled, add these rules
|
||||||
|
to your proguard configuration:
|
||||||
|
|
||||||
|
```proguard
|
||||||
|
-dontwarn okhttp3.**
|
||||||
|
-dontwarn okio.**
|
||||||
|
|
||||||
|
-keep class com.caverock.androidsvg.** { *; }
|
||||||
|
-dontwarn com.caverock.androidsvg.**
|
||||||
|
```
|
||||||
|
|
||||||
|
They come from dependencies that `markwon-image-loader` is using.
|
||||||
|
|
||||||
|
:::tip Other artifacts
|
||||||
|
Other artifacts do not require special Proguard rules
|
||||||
|
:::
|
||||||
|
|
||||||
## Snapshot
|
## Snapshot
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
In order to use latest `SNAPSHOT` version add snapshot repository
|
In order to use latest `SNAPSHOT` version add snapshot repository
|
||||||
to your root project's `build.gradle` file:
|
to your root project's `build.gradle` file:
|
||||||
|
|
||||||
@ -76,13 +92,18 @@ allprojects {
|
|||||||
repositories {
|
repositories {
|
||||||
jcenter()
|
jcenter()
|
||||||
google()
|
google()
|
||||||
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' } // <- this one
|
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
:::tip Info
|
and then in your module `build.gradle`:
|
||||||
All official artifacts share the same version number and all
|
|
||||||
are uploaded to **release** and **snapshot** repositories
|
```groovy
|
||||||
:::
|
implementation "ru.noties:markwon:${markwonSnapshotVersion}"
|
||||||
|
```
|
||||||
|
|
||||||
|
Please note that `markwon-image-loader`, `markwon-syntax-highlight`
|
||||||
|
and `markwon-view` are also present in `SNAPSHOT` repository and
|
||||||
|
share the same version as main `markwon` artifact.
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
<LegacyWarning />
|
|
||||||
|
|
||||||
# Syntax highlight
|
# Syntax highlight
|
||||||
|
|
||||||
<MavenBadge2xx artifact="markwon-syntax-highlight" />
|
<MavenBadge2xx artifact="markwon-syntax-highlight" />
|
@ -1,9 +1,7 @@
|
|||||||
<LegacyWarning />
|
|
||||||
|
|
||||||
# Theme
|
# Theme
|
||||||
|
|
||||||
Here is the list of properties that can be configured via `SpannableTheme`. If you wish to control what
|
Here is the list of properties that can be configured via `SpannableTheme`. If you wish to control what
|
||||||
is out of this list, you can use [SpannableFactory](/docs/v2/factory.md)
|
is out of this list, you can use [SpannableFactory](/docs/factory.md)
|
||||||
abstraction which lets you to gather full control of Spans that are used to display markdown.
|
abstraction which lets you to gather full control of Spans that are used to display markdown.
|
||||||
|
|
||||||
* `SpannableTheme#create(Context)` - creates a **default** instance of `SpannableBuilder (with _defaults_ registered)
|
* `SpannableTheme#create(Context)` - creates a **default** instance of `SpannableBuilder (with _defaults_ registered)
|
@ -1,79 +0,0 @@
|
|||||||
<LegacyWarning />
|
|
||||||
|
|
||||||
# Installation
|
|
||||||
|
|
||||||
<MavenBadges2xx />
|
|
||||||
|
|
||||||
In order to start using `Markwon` add this to your dependencies block
|
|
||||||
in your projects `build.gradle`:
|
|
||||||
|
|
||||||
```groovy
|
|
||||||
implementation "ru.noties:markwon:${markwonVersion}"
|
|
||||||
```
|
|
||||||
|
|
||||||
This is core artifact that is sufficient to start displaying markdown in your Android applications.
|
|
||||||
|
|
||||||
`Markwon` comes with more artifacts that cover additional functionality, but they are
|
|
||||||
**not** required to be used, as most of them provide implementations for functionality
|
|
||||||
that is _interfaced_ in the core artifact
|
|
||||||
|
|
||||||
```groovy
|
|
||||||
implementation "ru.noties:markwon-image-loader:${markwonVersion}"
|
|
||||||
implementation "ru.noties:markwon-syntax-highlight:${markwonVersion}"
|
|
||||||
implementation "ru.noties:markwon-view:${markwonVersion}"
|
|
||||||
```
|
|
||||||
|
|
||||||
These artifacts share the same _version_ as the core artifact
|
|
||||||
|
|
||||||
### Image loader
|
|
||||||
|
|
||||||
```groovy
|
|
||||||
implementation "ru.noties:markwon-image-loader:${markwonVersion}"
|
|
||||||
```
|
|
||||||
|
|
||||||
Provides implementation of `AsyncDrawable.Loader` and comes with support for:
|
|
||||||
* SVG
|
|
||||||
* GIF
|
|
||||||
* Other image formats
|
|
||||||
|
|
||||||
Please refer to documentation for [image loader](/docs/v2/image-loader.md) module
|
|
||||||
|
|
||||||
### Syntax highlight
|
|
||||||
|
|
||||||
```groovy
|
|
||||||
implementation "ru.noties:markwon-syntax-highlight:${markwonVersion}"
|
|
||||||
```
|
|
||||||
|
|
||||||
Provides implementation of `SyntaxHighlight` and allows various syntax highlighting
|
|
||||||
in your markdown based Android applications. Comes with 2 ready-to-be-used themes: `light` and `dark`.
|
|
||||||
Please refer to documentation for [syntax highlight](/docs/v2/syntax-highlight.md) module
|
|
||||||
|
|
||||||
### View
|
|
||||||
|
|
||||||
```groovy
|
|
||||||
implementation "ru.noties:markwon-view:${markwonVersion}"
|
|
||||||
```
|
|
||||||
|
|
||||||
Provides 2 widgets to display markdown: `MarkwonView` and `MarkwonViewCompat` (subclasses
|
|
||||||
of `TextView` and `AppCompatTextView` respectively).
|
|
||||||
Please refer to documentation for [view](/docs/v2/view.md) module
|
|
||||||
|
|
||||||
## Proguard
|
|
||||||
|
|
||||||
When using `markwon-image-loader` artifact and Proguard is enabled, add these rules
|
|
||||||
to your proguard configuration:
|
|
||||||
|
|
||||||
```proguard
|
|
||||||
-dontwarn okhttp3.**
|
|
||||||
-dontwarn okio.**
|
|
||||||
|
|
||||||
-keep class com.caverock.androidsvg.** { *; }
|
|
||||||
-dontwarn com.caverock.androidsvg.**
|
|
||||||
```
|
|
||||||
|
|
||||||
They come from dependencies that `markwon-image-loader` is using.
|
|
||||||
|
|
||||||
:::tip Other artifacts
|
|
||||||
Other artifacts do not require special Proguard rules
|
|
||||||
:::
|
|
||||||
|
|
72
docs/docs/v3/README.md
Normal file
72
docs/docs/v3/README.md
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
---
|
||||||
|
title: 'Introduction'
|
||||||
|
---
|
||||||
|
|
||||||
|
<img :src="$withBase('/art/markwon_logo.png')" alt="Markwon Logo" width="50%">
|
||||||
|
|
||||||
|
<br><br>
|
||||||
|
[](http://search.maven.org/#search|ga|1|g%3A%22ru.noties.markwon%22%20)
|
||||||
|
[](https://travis-ci.org/noties/Markwon)
|
||||||
|
|
||||||
|
**Markwon** is a markdown library for Android. It parses markdown following
|
||||||
|
<Link name="commonmark-spec" /> with the help of amazing <Link name="commonmark-java" /> library
|
||||||
|
and renders result as _Android-native_ Spannables. **No HTML** is involved
|
||||||
|
as an intermediate step. <u>**No WebView** is required</u>. It's extremely fast,
|
||||||
|
feature-rich and extensible.
|
||||||
|
|
||||||
|
It gives ability to display markdown in all TextView widgets (**TextView**,
|
||||||
|
**Button**, **Switch**, **CheckBox**, etc), **Toasts** and all other places that accept
|
||||||
|
**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
|
||||||
|
listed in <Link name="commonmark-spec" /> are supported (including support for **inlined/block HTML code**,
|
||||||
|
**markdown tables**, **images** and **syntax highlight**).
|
||||||
|
|
||||||
|
## Supported markdown features
|
||||||
|
|
||||||
|
* Emphasis (`*`, `_`)
|
||||||
|
* Strong emphasis (`**`, `__`)
|
||||||
|
* Headers (`#{1,6}`)
|
||||||
|
* Links (`[]()` && `[][]`)
|
||||||
|
* [Images](/docs/v3/core/images.md)
|
||||||
|
* Thematic break (`---`, `***`, `___`)
|
||||||
|
* Quotes & nested quotes (`>{1,}`)
|
||||||
|
* Ordered & non-ordered lists & nested ones
|
||||||
|
* Inline code
|
||||||
|
* Code blocks
|
||||||
|
* [Strike-through](/docs/v3/ext-strikethrough/) (`~~`)
|
||||||
|
* [Tables](/docs/v3/ext-tables/) (*with limitations*)
|
||||||
|
* [Syntax highlight](/docs/v3/syntax-highlight/)
|
||||||
|
* [LaTeX](/docs/v3/ext-latex/) formulas
|
||||||
|
* [HTML](/docs/v3/html/)
|
||||||
|
* Emphasis (`<i>`, `<em>`, `<cite>`, `<dfn>`)
|
||||||
|
* Strong emphasis (`<b>`, `<strong>`)
|
||||||
|
* SuperScript (`<sup>`)
|
||||||
|
* SubScript (`<sub>`)
|
||||||
|
* Underline (`<u>`, `ins`)
|
||||||
|
* Strike-through (`<s>`, `<strike>`, `<del>`)
|
||||||
|
* Link (`a`)
|
||||||
|
* Lists (`ul`, `ol`)
|
||||||
|
* Images (`img` will require configured image loader)
|
||||||
|
* Blockquote (`blockquote`)
|
||||||
|
* Heading (`h1`, `h2`, `h3`, `h4`, `h5`, `h6`)
|
||||||
|
* there is support to render any HTML tag, but it will require to create a special `TagHandler`,
|
||||||
|
more information can be found in [HTML section](/docs/v3/html/custom-tag-handler.md)
|
||||||
|
* [Task lists](/docs/v3/ext-tasklist/):
|
||||||
|
- [ ] Not _done_
|
||||||
|
- [X] **Done** with `X`
|
||||||
|
- [x] ~~and~~ **or** small `x`
|
||||||
|
|
||||||
|
## Screenshots
|
||||||
|
|
||||||
|
<img :src="$withBase('/art/mw_light_01.png')" alt="screenshot light #1" width="30%">
|
||||||
|
<img :src="$withBase('/art/mw_light_02.png')" alt="screenshot light #2" width="30%">
|
||||||
|
<img :src="$withBase('/art/mw_light_03.png')" alt="screenshot light #3" width="30%">
|
||||||
|
<img :src="$withBase('/art/mw_dark_01.png')" alt="screenshot dark #2" width="30%">
|
||||||
|
|
||||||
|
By default configuration uses TextView textColor for styling, so changing textColor changes style
|
||||||
|
|
||||||
|
:::tip Sample application
|
||||||
|
Screenshots are taken from sample application. It is a generic markdown viewer
|
||||||
|
with support to display markdown content via `http`, `https` & `file` schemes
|
||||||
|
and 2 themes included: Light & Dark. It can be downloaded from [releases](https://github.com/noties/Markwon/releases)
|
||||||
|
:::
|
@ -98,6 +98,6 @@ final Markwon markwon = Markwon.builder(this)
|
|||||||
:::warning
|
:::warning
|
||||||
Please note that `CorePlugin` will implicitly set a `LinkMovementMethod` on a TextView
|
Please note that `CorePlugin` will implicitly set a `LinkMovementMethod` on a TextView
|
||||||
if one is not present. If you wish to customize a MovementMethod that is used, apply
|
if one is not present. If you wish to customize a MovementMethod that is used, apply
|
||||||
one manually to a TextView (before applying markdown) or use the [MovementMethodPlugin](/docs/core/movement-method-plugin.md)
|
one manually to a TextView (before applying markdown) or use the [MovementMethodPlugin](/docs/v3/core/movement-method-plugin.md)
|
||||||
which accepts a MovementMethod as an argument.
|
which accepts a MovementMethod as an argument.
|
||||||
:::
|
:::
|
@ -1,7 +1,7 @@
|
|||||||
# Getting started
|
# Getting started
|
||||||
|
|
||||||
:::tip Installation
|
:::tip Installation
|
||||||
Please follow [installation](/docs/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
|
||||||
:::
|
:::
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ Toast.makeText(context, markdown, Toast.LENGTH_LONG).show();
|
|||||||
:::warning 3.x.x migration
|
:::warning 3.x.x migration
|
||||||
Starting with <Badge text="3.0.0" /> version Markwon no longer relies on static
|
Starting with <Badge text="3.0.0" /> version Markwon no longer relies on static
|
||||||
utility methods. To learn more about migrating existing applications
|
utility methods. To learn more about migrating existing applications
|
||||||
refer to [migration](/docs/migration-2-3.md) section.
|
refer to [migration](/docs/v3/migration-2-3.md) section.
|
||||||
:::
|
:::
|
||||||
|
|
||||||
## Longer one
|
## Longer one
|
||||||
@ -62,4 +62,4 @@ Toast.makeText(context, markdown, Toast.LENGTH_LONG).show();
|
|||||||
This section is kept due to historical reasons. Starting with version <Badge text="3.0.0" />
|
This section is kept due to historical reasons. Starting with version <Badge text="3.0.0" />
|
||||||
the amount of magic is reduced. To leverage your `Markwon` usage a concept of `Plugin`
|
the amount of magic is reduced. To leverage your `Markwon` usage a concept of `Plugin`
|
||||||
is introduced which helps to extend default behavior in a simple and _no-breaking-the-flow_ manner.
|
is introduced which helps to extend default behavior in a simple and _no-breaking-the-flow_ manner.
|
||||||
Head to the [next section](/docs/core/plugins.md) to know more.
|
Head to the [next section](/docs/v3/core/plugins.md) to know more.
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
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/image/svg.md) or [GIF](/docs/image/gif.md) which
|
decoder (for simple images, no [SVG](/docs/v3/image/svg.md) or [GIF](/docs/v3/image/gif.md) which
|
||||||
are defined in standalone modules).
|
are defined in standalone modules).
|
||||||
|
|
||||||
## ImagesPlugin
|
## ImagesPlugin
|
||||||
@ -114,7 +114,7 @@ be used.
|
|||||||
## MediaDecoder
|
## MediaDecoder
|
||||||
|
|
||||||
:::tip
|
:::tip
|
||||||
If you are using [html](/docs/html/) you do not have to additionally setup
|
If you are using [html](/docs/v3/html/) you do not have to additionally setup
|
||||||
images displayed via `<img>` tag, as `HtmlPlugin` automatically uses configured
|
images displayed via `<img>` tag, as `HtmlPlugin` automatically uses configured
|
||||||
image loader. But images referenced in HTML come with additional support for
|
image loader. But images referenced in HTML come with additional support for
|
||||||
sizes, which is not supported natively by markdown, allowing absolute or relative sizes:
|
sizes, which is not supported natively by markdown, allowing absolute or relative sizes:
|
@ -87,7 +87,7 @@ added CorePlugin _explicitly_ as `AbstractMarkwonPlugin` declares a dependency o
|
|||||||
If it's not desireable override `AbstractMarkwonPlugin#priority` method to specify own rules.
|
If it's not desireable override `AbstractMarkwonPlugin#priority` method to specify own rules.
|
||||||
:::
|
:::
|
||||||
|
|
||||||
More information about `MarkwonTheme` can be found [here](/docs/core/theme.md).
|
More information about `MarkwonTheme` can be found [here](/docs/v3/core/theme.md).
|
||||||
|
|
||||||
|
|
||||||
## Images
|
## Images
|
||||||
@ -126,7 +126,7 @@ Markwon.builder(context)
|
|||||||
Without explicit usage of `ImagesPlugin` all image configuration will be ignored (no-op'ed)
|
Without explicit usage of `ImagesPlugin` all image configuration will be ignored (no-op'ed)
|
||||||
:::
|
:::
|
||||||
|
|
||||||
More information about dealing with images can be found [here](/docs/core/images.md)
|
More information about dealing with images can be found [here](/docs/v3/core/images.md)
|
||||||
|
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
@ -152,7 +152,7 @@ final Markwon markwon = Markwon.builder(context)
|
|||||||
.build();
|
.build();
|
||||||
```
|
```
|
||||||
|
|
||||||
More information about `MarkwonConfiguration` can be found [here](/docs/core/configuration.md)
|
More information about `MarkwonConfiguration` can be found [here](/docs/v3/core/configuration.md)
|
||||||
|
|
||||||
|
|
||||||
## Visitor
|
## Visitor
|
||||||
@ -196,7 +196,7 @@ Please note that `Priority` plays nicely here to ensure that your
|
|||||||
custom Node override/disable happens _after_ some plugin defines it.
|
custom Node override/disable happens _after_ some plugin defines it.
|
||||||
:::
|
:::
|
||||||
|
|
||||||
More information about `MarkwonVisitor` can be found [here](/docs/core/visitor.md)
|
More information about `MarkwonVisitor` can be found [here](/docs/v3/core/visitor.md)
|
||||||
|
|
||||||
|
|
||||||
## Spans Factory
|
## Spans Factory
|
||||||
@ -237,7 +237,7 @@ public Object getSpans(@NonNull MarkwonConfiguration configuration, @NonNull Ren
|
|||||||
```
|
```
|
||||||
:::
|
:::
|
||||||
|
|
||||||
More information about spans factory can be found [here](/docs/core/spans-factory.md)
|
More information about spans factory can be found [here](/docs/v3/core/spans-factory.md)
|
||||||
|
|
||||||
|
|
||||||
## HTML Renderer
|
## HTML Renderer
|
||||||
@ -276,7 +276,7 @@ project **explicitly** and then registered via `Markwon.Builder#usePlugin(HtmlPl
|
|||||||
If not done so, no HTML will be parsed nor rendered.
|
If not done so, no HTML will be parsed nor rendered.
|
||||||
:::
|
:::
|
||||||
|
|
||||||
More information about HTML rendering can be found [here](/docs/core/html-renderer.md)
|
More information about HTML rendering can be found [here](/docs/v3/core/html-renderer.md)
|
||||||
|
|
||||||
|
|
||||||
## Priority
|
## Priority
|
90
docs/docs/v3/install.md
Normal file
90
docs/docs/v3/install.md
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
---
|
||||||
|
prev: false
|
||||||
|
next: /docs/v3/core/getting-started.md
|
||||||
|
---
|
||||||
|
|
||||||
|
# Installation
|
||||||
|
|
||||||
|

|
||||||
|

|
||||||
|
|
||||||
|
<ArtifactPicker />
|
||||||
|
|
||||||
|
# Bundle <Badge text="3.0.0" />
|
||||||
|
If you wish to include all Markwon artifacts or add specific artifacts
|
||||||
|
in a different manner than explicit gradle dependency definition, you can
|
||||||
|
use `markwon-bundle.gradle` gradle script:
|
||||||
|
|
||||||
|
*(in your `build.gradle`)*
|
||||||
|
```groovy
|
||||||
|
apply plugin: 'com.android.application'
|
||||||
|
apply from: 'https://raw.githubusercontent.com/noties/Markwon/master/markwon-bundle.gradle'
|
||||||
|
|
||||||
|
android { /* */ }
|
||||||
|
|
||||||
|
ext.markwon = [
|
||||||
|
'version': '3.0.0',
|
||||||
|
'includeAll': true
|
||||||
|
]
|
||||||
|
|
||||||
|
dependencies { /* */ }
|
||||||
|
```
|
||||||
|
|
||||||
|
`markwon` object can have these properties:
|
||||||
|
* `version` - (required) version of `Markwon`
|
||||||
|
* `includeAll` - if _true_ will add all known Markwon artifacts. Can be used with `exclude`
|
||||||
|
* * `exclude` - an array of artifacts to _exclude_ (cannot exclude `core`)
|
||||||
|
* `artifacts` - an array of artifacts (can omit `core`, as it will be added implicitly anyway)
|
||||||
|
|
||||||
|
If `includeAll` property is present and is `true`, then `artifacts` property won't be used.
|
||||||
|
If there is no `includeAll` property or if it is `false`, `exclude` property won't be used.
|
||||||
|
|
||||||
|
These 2 markwon objects are equal:
|
||||||
|
|
||||||
|
```groovy
|
||||||
|
// #1
|
||||||
|
ext.markwon = [
|
||||||
|
'version': '3.0.0',
|
||||||
|
'artifacts': [
|
||||||
|
'ext-latex',
|
||||||
|
'ext-strikethrough',
|
||||||
|
'ext-tables',
|
||||||
|
'ext-tasklist',
|
||||||
|
'html',
|
||||||
|
'image-gif',
|
||||||
|
'image-okhttp',
|
||||||
|
'image-svg',
|
||||||
|
'recycler',
|
||||||
|
'syntax-highlight'
|
||||||
|
]
|
||||||
|
]
|
||||||
|
|
||||||
|
// #2
|
||||||
|
ext.markwon = [
|
||||||
|
'version': '3.0.0',
|
||||||
|
'includeAll': true
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
## Snapshot
|
||||||
|
|
||||||
|
In order to use latest `SNAPSHOT` version add snapshot repository
|
||||||
|
to your root project's `build.gradle` file:
|
||||||
|
|
||||||
|
```groovy
|
||||||
|
allprojects {
|
||||||
|
repositories {
|
||||||
|
jcenter()
|
||||||
|
google()
|
||||||
|
// this one 👇
|
||||||
|
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' } // 👈 this one
|
||||||
|
// this one 👆
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
:::tip Info
|
||||||
|
All official artifacts share the same version number and all
|
||||||
|
are uploaded to **release** and **snapshot** repositories
|
||||||
|
:::
|
||||||
|
|
@ -6,3 +6,5 @@
|
|||||||
* * Handling of GIF and SVG media moved to standalone modules (`gif` and `svg` respectively)
|
* * Handling of GIF and SVG media moved to standalone modules (`gif` and `svg` respectively)
|
||||||
* * OkHttpClient to download images moved to standalone module
|
* * OkHttpClient to download images moved to standalone module
|
||||||
* HTML no longer _implicitly_ added to core functionality, it must be specified __explicitly__ (as an artifact)
|
* HTML no longer _implicitly_ added to core functionality, it must be specified __explicitly__ (as an artifact)
|
||||||
|
* removed `markwon-view` module
|
||||||
|
* changed Maven artifacts group to `ru.noties.markwon`
|
@ -1,5 +1,3 @@
|
|||||||
<LegacyWarning />
|
|
||||||
|
|
||||||
# MarkwonView
|
# MarkwonView
|
||||||
|
|
||||||
<MavenBadge2xx artifact="markwon-view" />
|
<MavenBadge2xx artifact="markwon-view" />
|
@ -1,7 +0,0 @@
|
|||||||
# Donations
|
|
||||||
|
|
||||||
If you find this library useful consider making a donation
|
|
||||||
to your local [environmental](https://en.wikipedia.org/wiki/List_of_environmental_organizations)
|
|
||||||
or [human rights](https://en.wikipedia.org/wiki/List_of_human_rights_organisations) organization.
|
|
||||||
|
|
||||||
Thank you
|
|
Loading…
x
Reference in New Issue
Block a user