diff --git a/README.md b/README.md index be6976a9..6e15de8a 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,8 @@ # Markwon -[![markwon](https://img.shields.io/maven-central/v/ru.noties/markwon.svg?label=markwon)](http://search.maven.org/#search|ga|1|g%3A%22ru.noties%22%20AND%20a%3A%22markwon%22) -[![markwon-image-loader](https://img.shields.io/maven-central/v/ru.noties/markwon-image-loader.svg?label=markwon-image-loader)](http://search.maven.org/#search|ga|1|g%3A%22ru.noties%22%20AND%20a%3A%22markwon-image-loader%22) -[![markwon-syntax-highlight](https://img.shields.io/maven-central/v/ru.noties/markwon-syntax-highlight.svg?label=markwon-syntax-highlight)](http://search.maven.org/#search|ga|1|g%3A%22ru.noties%22%20AND%20a%3A%22markwon-syntax-highlight%22) -[![markwon-view](https://img.shields.io/maven-central/v/ru.noties/markwon-view.svg?label=markwon-view)](http://search.maven.org/#search|ga|1|g%3A%22ru.noties%22%20AND%20a%3A%22markwon-view%22) +![stable](https://img.shields.io/maven-central/v/ru.noties.markwon/core.svg?label=stable) +![snapshot](https://img.shields.io/nexus/s/https/oss.sonatype.org/ru.noties.markwon/core.svg?label=snapshot) [![Build Status](https://travis-ci.org/noties/Markwon.svg?branch=master)](https://travis-ci.org/noties/Markwon) @@ -33,14 +31,12 @@ features listed in [commonmark-spec] are supported ## Installation ```groovy -implementation "ru.noties:markwon:${markwonVersion}" -implementation "ru.noties:markwon-image-loader:${markwonVersion}" // optional -implementation "ru.noties:markwon-syntax-highlight:${markwonVersion}" // optional -implementation "ru.noties:markwon-view:${markwonVersion}" // optional +implementation "ru.noties.markwon:core:${markwonVersion}" ``` Please visit [documentation] web-site for further reference + ## Supported markdown features: * Emphasis (`*`, `_`) * Strong emphasis (`**`, `__`) @@ -55,6 +51,7 @@ Please visit [documentation] web-site for further reference * Code blocks * Tables (*with limitations*) * Syntax highlight +* LaTeX formulas * HTML * Emphasis (``, ``, ``, ``) * Strong emphasis (``, ``) diff --git a/app/src/main/java/ru/noties/markwon/gif/GifProcessor.java b/app/src/main/java/ru/noties/markwon/gif/GifProcessor.java index fcec2e17..8cdb1da5 100644 --- a/app/src/main/java/ru/noties/markwon/gif/GifProcessor.java +++ b/app/src/main/java/ru/noties/markwon/gif/GifProcessor.java @@ -115,12 +115,13 @@ public abstract class GifProcessor { } @Override - public void onClick(View widget) { + public void onClick(@NonNull View widget) { if (gifDrawable.isPlaying()) { gifDrawable.pause(); } else { gifDrawable.start(); } + widget.invalidate(); } } } diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index 5a0cbe66..dc157e44 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -12,20 +12,30 @@ module.exports = { ], themeConfig: { nav: [ - { text: 'Install', link: '/docs/install.md' }, + { text: 'Install', link: '/docs/v3/install.md' }, { text: 'Changelog', link: '/CHANGELOG.md' }, { text: 'API Version', items: [ - { text: 'Current (2.x.x)', link: '/' }, - { text: 'BETA (3.x.x)', link: '/docs/v3/' } + { text: 'Current (3.x.x)', link: '/' }, + { text: 'Legacy (2.x.x)', link: '/docs/v2/' } ] }, { text: 'Sandbox', link: '/sandbox.md' }, { text: 'Github', link: 'https://github.com/noties/Markwon' } ], sidebar: { - '/docs/v3/': [ + '/docs/v2': [ + '/docs/v2/getting-started.md', + '/docs/v2/configure.md', + '/docs/v2/theme.md', + '/docs/v2/factory.md', + '/docs/v2/image-loader.md', + '/docs/v2/syntax-highlight.md', + '/docs/v2/html.md', + '/docs/v2/view.md' + ], + '/': [ '', { title: 'Core', @@ -56,17 +66,6 @@ module.exports = { '/docs/v3/recycler-table/', '/docs/v3/syntax-highlight/', '/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, diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index cfb1a790..fd3e24e2 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,6 +1,44 @@ # Changelog -# 2.0.1 +# 3.0.0 +* Plugins, plugins, plugins +* Split basic functionality blocks into standalone modules +* Maven artifacts group changed to `ru.noties.markwon` (previously had been `ru.noties`) +* removed `markwon`, `markwon-image-loader`, `markwon-html-pareser-api`, `markwon-html-parser-impl`, `markwon-view` modules +* new module system: `core`, `ext-latex`, `ext-strikethrough`, `ext-tables`, `ext-tasklist`, `html`, `image-gif`, `image-okhttp`, `image-svg`, `recycler`, `recycler-table`, `syntax-highlight` +* Add BufferType option for Markwon configuration +* Fix typo in AsyncDrawable waitingForDimensions +* New tests format +* `Markwon.render` returns `Spanned` instance of generic `CharSequence` +* LinkMovementMethod is applied implicitly if not set on a TextView explicitly +* Split code and codeBlock spans and factories +* Add CustomTypefaceSpan +* Add NoCopySpansFactory +* Add placeholder to image loading + +Generally speaking there are a lot of changes. Most of them are not backwards-compatible. +The main point of this release is the `Plugin` system that allows more fluent configuration +and opens the possibility of extending `Markwon` with 3rd party functionality in a simple +and intuitive fashion. Please refer to the [documentation web-site](https://noties.github.io/Markwon) +that has information on how to start migration. + +The shortest excerpt of this release can be expressed like this: + +```java +// previous v2.x.x way +Markwon.setMarkdown(textView, "**Hello there!**"); +``` + +```java +// 3.x.x +Markwon.create(context) + .setMarkdown(textView, "**Hello there!**"); +``` + +But there is much more to it, please visit documentation web-site +to get the full picture of latest changes. + +## 2.0.1 * `SpannableMarkdownVisitor` Rename blockQuoteIndent to blockIndent * Fixed block new lines logic for block quote and paragraph () * AsyncDrawable fix no dimensions bug () diff --git a/docs/README.md b/docs/README.md index 0dce1917..521bb1d5 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,11 +1,12 @@ --- -title: 'Overview' +title: 'Introduction' --- -Markwon Logo +Markwon Logo

- +[![markwon](https://img.shields.io/maven-central/v/ru.noties.markwon/core.svg?label=markwon)](http://search.maven.org/#search|ga|1|g%3A%22ru.noties.markwon%22%20) +[![Build Status](https://travis-ci.org/noties/Markwon.svg?branch=master)](https://travis-ci.org/noties/Markwon) **Markwon** is a markdown library for Android. It parses markdown following with the help of amazing library @@ -20,22 +21,23 @@ but also gives all the means to tweak the appearance if desired. All markdown fe listed in are supported (including support for **inlined/block HTML code**, **markdown tables**, **images** and **syntax highlight**). -## Supported markdown features: +## Supported markdown features * Emphasis (`*`, `_`) * Strong emphasis (`**`, `__`) -* Strike-through (`~~`) * Headers (`#{1,6}`) * Links (`[]()` && `[][]`) -* [Images](/docs/image-loader.md) +* [Images](/docs/v3/core/images.md) * Thematic break (`---`, `***`, `___`) * Quotes & nested quotes (`>{1,}`) * Ordered & non-ordered lists & nested ones * Inline code * Code blocks -* Tables (*with limitations*) -* [Syntax highlight](/docs/syntax-highlight.md) -* [HTML](/docs/html.md) +* [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 (``, ``, ``, ``) * Strong emphasis (``, ``) * SuperScript (``) @@ -48,12 +50,14 @@ listed in are supported (including support for * * 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/html.md#custom-tag-handler) -* Task lists: + more information can be found in [HTML section](/docs/v3/core/html-renderer.md) +* [Task lists](/docs/v3/ext-tasklist/): - [ ] Not _done_ - [X] **Done** with `X` - [x] ~~and~~ **or** small `x` +* Task-lists are not properly displayed on this web-site, library renders them correctly + ## Screenshots screenshot light #1 @@ -68,3 +72,24 @@ 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) ::: + + +## Awesome Markwon + +Applications using Markwon: + +* [Partico](https://partiko.app/) - Partiko is a censorship free social network. +* [FairNote](https://play.google.com/store/apps/details?id=com.rgiskard.fairnote) - simple and intuitive notepad app. It gives you speed and efficiency when you write notes, to-do lists, e-mails, or jot down quick ideas. + + +Extension/plugins: + +* [MarkwonCodeEx](https://github.com/kingideayou/MarkwonCodeEx) - Markwon extension support elegant code background. + +--- + +[Help to improve][awesome_link] this section by submitting your application or library +that is using `Markwon` + + +[awesome_link]: https://github.com/noties/Markwon/issues/new?labels=awesome&body=Please%20provide%20the%20following%3A%0A*%20Project%20name%0A*%20Project%20URL%20(repository%2C%20store%20listing%2C%20web%20page)%0A*%20Optionally%20_brand_%20image%20URL%0A%0APlease%20make%20sure%20that%20there%20is%20the%20**awesome**%20label%20selected%20for%20this%20issue.%0A%0A%F0%9F%99%8C%20 diff --git a/docs/docs/v3/README.md b/docs/docs/v2/README.md similarity index 59% rename from docs/docs/v3/README.md rename to docs/docs/v2/README.md index b8e28b4c..20275911 100644 --- a/docs/docs/v3/README.md +++ b/docs/docs/v2/README.md @@ -1,12 +1,11 @@ --- -title: 'Introduction' +title: 'Overview' --- Markwon Logo

-[![markwon](https://img.shields.io/maven-central/v/ru.noties.markwon/core.svg?label=markwon)](http://search.maven.org/#search|ga|1|g%3A%22ru.noties.markwon%22%20) -[![Build Status](https://travis-ci.org/noties/Markwon.svg?branch=master)](https://travis-ci.org/noties/Markwon) + **Markwon** is a markdown library for Android. It parses markdown following with the help of amazing library @@ -21,23 +20,22 @@ but also gives all the means to tweak the appearance if desired. All markdown fe listed in are supported (including support for **inlined/block HTML code**, **markdown tables**, **images** and **syntax highlight**). -## Supported markdown features +## Supported markdown features: * Emphasis (`*`, `_`) * Strong emphasis (`**`, `__`) +* Strike-through (`~~`) * Headers (`#{1,6}`) * Links (`[]()` && `[][]`) -* [Images](/docs/v3/core/images.md) +* [Images](/docs/v2/image-loader.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/) +* Tables (*with limitations*) +* [Syntax highlight](/docs/v2/syntax-highlight.md) +* [HTML](/docs/v2/html.md) * Emphasis (``, ``, ``, ``) * Strong emphasis (``, ``) * SuperScript (``) @@ -50,8 +48,8 @@ listed in are supported (including support for * * 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/core/html-renderer.md) -* [Task lists](/docs/v3/ext-tasklist/): + more information can be found in [HTML section](/docs/v2/html.md#custom-tag-handler) +* Task lists: - [ ] Not _done_ - [X] **Done** with `X` - [x] ~~and~~ **or** small `x` @@ -70,24 +68,3 @@ 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) ::: - - -## Awesome Markwon - -Applications using Markwon: - -* [Partico](https://partiko.app/) - Partiko is a censorship free social network. -* [FairNote](https://play.google.com/store/apps/details?id=com.rgiskard.fairnote) - simple and intuitive notepad app. It gives you speed and efficiency when you write notes, to-do lists, e-mails, or jot down quick ideas. - - -Extension/plugins: - -* [MarkwonCodeEx](https://github.com/kingideayou/MarkwonCodeEx) - Markwon extension support elegant code background. - ---- - -[Help to improve][awesome_link] this section by submitting your application or library -that is using `Markwon` - - -[awesome_link]: https://github.com/noties/Markwon/issues/new?labels=awesome&body=Please%20provide%20the%20following%3A%0A*%20Project%20name%0A*%20Project%20URL%20(repository%2C%20store%20listing%2C%20web%20page)%0A*%20Optionally%20_brand_%20image%20URL%0A%0APlease%20make%20sure%20that%20there%20is%20the%20**awesome**%20label%20selected%20for%20this%20issue.%0A%0A%F0%9F%99%8C%20 diff --git a/docs/docs/configure.md b/docs/docs/v2/configure.md similarity index 94% rename from docs/docs/configure.md rename to docs/docs/v2/configure.md index 1d09e5fc..4ba81749 100644 --- a/docs/docs/configure.md +++ b/docs/docs/v2/configure.md @@ -24,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** register an implementation of `AsyncDrawable.Loader` via `#asyncDrawableLoader` builder method. `Markwon` comes with ready implementation for that and it can be found in -`markwon-image-loader` module. Refer to module [documentation](/docs/image-loader.md) +`markwon-image-loader` module. Refer to module [documentation](/docs/v2/image-loader.md) ::: ## Theme `SpannableTheme` controls how markdown is rendered. It has pretty extensive number of -options that can be found [here](/docs/theme.md) +options that can be found [here](/docs/v2/theme.md) ```java SpannableConfiguration.builder(context) @@ -56,7 +56,7 @@ If `AsyncDrawable.Loader` is not provided explicitly, default **no-op** implemen :::tip Implementation 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/image-loader.md) +answer the most common needs of displaying SVG, GIF and other image formats. It can be found [here](/docs/v2/image-loader.md) ::: ### Size resolver @@ -107,7 +107,7 @@ If not provided explicitly, default **no-op** implementation will be used. Although `SyntaxHighlight` interface was included with the very first version of `Markwon` there were no ready-to-use implementations. But starting with `Markwon` provides one. It can be found in `markwon-syntax-highlight` artifact. Refer -to module [documentation](/docs/syntax-highlight.md) +to module [documentation](/docs/v2/syntax-highlight.md) ::: ## Link resolver @@ -166,7 +166,7 @@ SpannableConfiguration.builder(context) ``` If not provided explicitly, default `SpannableFactoryDef` implementation will be used. It is documented -in [this section](/docs/factory.md) +in [this section](/docs/v2/factory.md) ## Soft line break @@ -197,7 +197,7 @@ SpannableConfiguration.builder(context) if not provided explicitly, default `MarkwonHtmlParserImpl` will be used **if** it can be found in classpath, otherwise default **no-op** implementation -wiil be used. Refer to [HTML](/docs/html.md#parser) document for more information about this behavior. +wiil be used. Refer to [HTML](/docs/v2/html.md#parser) document for more information about this behavior. ### Renderer @@ -210,7 +210,7 @@ SpannableConfiguration.builder(context) ``` If not provided explicitly, default `MarkwonHtmlRenderer` implementation will be used. -It is documented [here](/docs/html.md#renderer) +It is documented [here](/docs/v2/html.md#renderer) ### HTML allow non-closed tags diff --git a/docs/docs/factory.md b/docs/docs/v2/factory.md similarity index 100% rename from docs/docs/factory.md rename to docs/docs/v2/factory.md diff --git a/docs/docs/getting-started.md b/docs/docs/v2/getting-started.md similarity index 98% rename from docs/docs/getting-started.md rename to docs/docs/v2/getting-started.md index bed30085..3361767a 100644 --- a/docs/docs/getting-started.md +++ b/docs/docs/v2/getting-started.md @@ -20,7 +20,7 @@ Toast.makeText(context, markdown, Toast.LENGTH_LONG).show(); ## Longer one -When you need to customize markdown parsing/rendering you can use [SpannableConfiguration](/docs/configure.md): +When you need to customize markdown parsing/rendering you can use [SpannableConfiguration](/docs/v2/configure.md): ```java final SpannableConfiguration configuration = SpannableConfiguration.builder(context) diff --git a/docs/docs/html.md b/docs/docs/v2/html.md similarity index 100% rename from docs/docs/html.md rename to docs/docs/v2/html.md diff --git a/docs/docs/image-loader.md b/docs/docs/v2/image-loader.md similarity index 98% rename from docs/docs/image-loader.md rename to docs/docs/v2/image-loader.md index ca79337e..6dca5991 100644 --- a/docs/docs/image-loader.md +++ b/docs/docs/v2/image-loader.md @@ -21,7 +21,7 @@ public interface Loader { `AsyncDrawableLoader` from `markwon-image-loader` artifact can be used. :::tip Install -[Learn how to add](/docs/install.md#image-loader) `markwon-image-loader` to your project +[Learn how to add](/docs/v2/install.md#image-loader) `markwon-image-loader` to your project ::: Default instance of `AsyncDrawableLoader` can be obtain like this: diff --git a/docs/docs/install.md b/docs/docs/v2/install.md similarity index 91% rename from docs/docs/install.md rename to docs/docs/v2/install.md index 3b4c735c..b46816dd 100644 --- a/docs/docs/install.md +++ b/docs/docs/v2/install.md @@ -39,7 +39,7 @@ Provides implementation of `AsyncDrawable.Loader` and comes with support for: * GIF * Other image formats -Please refer to documentation for [image loader](/docs/image-loader.md) module +Please refer to documentation for [image loader](/docs/v2/image-loader.md) module ### Syntax highlight @@ -49,7 +49,7 @@ 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 +Please refer to documentation for [syntax highlight](/docs/v2/syntax-highlight.md) module ### View @@ -59,7 +59,7 @@ 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 +Please refer to documentation for [view](/docs/v2/view.md) module ## Proguard diff --git a/docs/docs/syntax-highlight.md b/docs/docs/v2/syntax-highlight.md similarity index 100% rename from docs/docs/syntax-highlight.md rename to docs/docs/v2/syntax-highlight.md diff --git a/docs/docs/theme.md b/docs/docs/v2/theme.md similarity index 98% rename from docs/docs/theme.md rename to docs/docs/v2/theme.md index 4baf954c..292e3e39 100644 --- a/docs/docs/theme.md +++ b/docs/docs/v2/theme.md @@ -1,7 +1,7 @@ # Theme 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/factory.md) +is out of this list, you can use [SpannableFactory](/docs/v2/factory.md) 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) diff --git a/docs/docs/view.md b/docs/docs/v2/view.md similarity index 100% rename from docs/docs/view.md rename to docs/docs/v2/view.md diff --git a/docs/docs/v3/ext-tables/README.md b/docs/docs/v3/ext-tables/README.md index fe149ed2..8c75fc21 100644 --- a/docs/docs/v3/ext-tables/README.md +++ b/docs/docs/v3/ext-tables/README.md @@ -56,7 +56,7 @@ myTableWidget.setTable(table); :::tip To take advantage of this functionality and render tables without limitations (including -horizontally scrollable layout when its contents exceed screen width), refer to [recycler-table](/docs/v3/recycler-table) +horizontally scrollable layout when its contents exceed screen width), refer to [recycler-table](/docs/v3/recycler-table/) module documentation that adds support for rendering `TableBlock` markdown node inside Android-native `TableLayout` widget. ::: diff --git a/docs/docs/v3/html/README.md b/docs/docs/v3/html/README.md index a8a12d1b..12f66400 100644 --- a/docs/docs/v3/html/README.md +++ b/docs/docs/v3/html/README.md @@ -59,3 +59,5 @@ So, if your `Markwon` instance was configured to, for example, render Emphasis nodes as a red text then HTML tag handler will use the same span. This includes images, links, UrlResolver, LinkProcessor, etc ::: + +To learn more about defining own TagHandlers, please refer to [html-renderer docs](/docs/v3/core/html-renderer.md) diff --git a/docs/docs/v3/install.md b/docs/docs/v3/install.md index 7f7184b7..19c28cba 100644 --- a/docs/docs/v3/install.md +++ b/docs/docs/v3/install.md @@ -5,7 +5,7 @@ next: /docs/v3/core/getting-started.md # Installation -![release](https://img.shields.io/maven-central/v/ru.noties.markwon/core.svg?label=release) +![stable](https://img.shields.io/maven-central/v/ru.noties.markwon/core.svg?label=stable) ![snapshot](https://img.shields.io/nexus/s/https/oss.sonatype.org/ru.noties.markwon/core.svg?label=snapshot)