diff --git a/.travis.yml b/.travis.yml index ec7e3e53..b77bdebc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,9 @@ # https://docs.travis-ci.com/user/languages/android/ + language: android + +# so, out of blue travis requires this now (without it build would not even execute, immediate failure when downloading jdk) +dist: trusty jdk: openjdk8 sudo: false diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..7551a2a3 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,219 @@ +# Changelog + +# 4.0.0 +* maven group-id change to `io.noties.markwon` (was `ru.noties.markwon`) +* package name change to `io.notier.markwon.*` (was `ru.noties.markwon.*`) +* androidx artifacts ([#76]) +* `Markwon#builder` does not require explicit `CorePlugin` (added automatically), +use `Markwon#builderNoCore()` to obtain a builder without `CorePlugin` +* Removed `Priority` abstraction and `MarkwonPlugin#priority` (use `MarkwonPlugin.Registry`) +* Removed `MarkwonPlugin#configureHtmlRenderer` (for configuration use `HtmlPlugin` directly) +* Removed `MarkwonPlugin#configureImages` (for configuration use `ImagesPlugin` directly) +* Added `MarkwonPlugin.Registry` and `MarkwonPlugin#configure(Registry)` method +* `CorePlugin#addOnTextAddedListener` (process raw text added) +* `ImageSizeResolver` signature change (accept `AsyncDrawable`) +* `LinkResolver` is now an independent entity (previously part of `LinkSpan`) +* `AsyncDrawableScheduler` can now be called multiple times without performance penalty +* `AsyncDrawable` now exposes its destination, image-size, last known dimensions (canvas, text-size) +* `AsyncDrawableLoader` signature change (accept `AsyncDrawable`) +* Add `LastLineSpacingSpan` +* Add `MarkwonConfiguration.Builder#asyncDrawableLoader` method +* `ImagesPlugin` removed from `core` artifact +(also removed `images-gif`, `images-okhttp` and `images-svg` artifacts and their plugins) +* `ImagesPlugin` exposes configuration (adding scheme-handler, media-decoder, etc) +* `ImagesPlugin` allows multiple images with the same source (URL) +* Add `PlaceholderProvider` and `ErrorHandler` to `ImagesPlugin` +* `GIF` and `SVG` media-decoders are automatically added to `ImagesPlugin` if required libraries are found in the classpath +* `ImageItem` is now abstract, has 2 implementations: `withResult`, `withDecodingNeeded` +* Add `images-glide`, `images-picasso`, `linkify`, `simple-ext` modules +* `JLatexMathPlugin` is now independent of `ImagesPlugin` +* Fix wrong `JLatexMathPlugin` formulas sizes ([#138]) +* `JLatexMathPlugin` has `backgroundProvider`, `executorService` configuration +* `HtmlPlugin` is self-contained (all configuration is moved in the plugin itself) + +[#76]: https://github.com/noties/Markwon/issues/76 +[#138]: https://github.com/noties/Markwon/issues/138 + + +## 3.0.2 +* Fix `latex` plugin ([#136]) +* Add `#create(Call.Factory)` factory method to `OkHttpImagesPlugin` ([#129]) +
Thanks to [@ZacSweers] + +[#136]: https://github.com/noties/Markwon/issues/136 +[#129]: https://github.com/noties/Markwon/issues/129 +[@ZacSweers]: https://github.com/ZacSweers + + +## 3.0.1 +* Add `AsyncDrawableLoader.Builder#implementation` method ([#109]) +* AsyncDrawable allow placeholder to have independent size ([#115]) +* `addFactory` method for MarkwonSpansFactory +* Add optional spans for list blocks (bullet and ordered) +* AsyncDrawable placeholder bounds fix +* SpannableBuilder setSpans allow array of arrays +* Add `requireFactory` method to MarkwonSpansFactory +* Add DrawableUtils + +[#109]: https://github.com/noties/Markwon/issues/109 +[#115]: https://github.com/noties/Markwon/issues/115 + + +## 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 ([#82]) +* AsyncDrawable fix no dimensions bug ([#81]) +* Update SpannableTheme to use Px instead of Dimension annotation +* Allow TaskListSpan isDone mutation +* Updated commonmark-java to 0.12.1 +* Add OrderedListItemSpan measure utility method ([#78]) +* Add SpannableBuilder#getSpans method +* Fix DataUri scheme handler in image-loader ([#74]) +* Introduced a "copy" builder for SpannableThem +
Thanks [@c-b-h] + +[#82]: https://github.com/noties/Markwon/issues/82 +[#81]: https://github.com/noties/Markwon/issues/81 +[#78]: https://github.com/noties/Markwon/issues/78 +[#74]: https://github.com/noties/Markwon/issues/74 +[@c-b-h]: https://github.com/c-b-h + + +## 2.0.0 +* Add `html-parser-api` and `html-parser-impl` modules +* Add `HtmlEmptyTagReplacement` +* Implement Appendable and CharSequence in SpannableBuilder +* Renamed library modules to reflect maven artifact names +* Rename `markwon-syntax` to `markwon-syntax-highlight` +* Add HtmlRenderer asbtraction +* Add CssInlineStyleParser +* Fix Theme#listItemColor and OL +* Fix task list block parser to revert parsing state when line is not matching +* Defined test format files +* image-loader add datauri parser +* image-loader add support for inline data uri image references +* Add travis configuration +* Fix image with width greater than canvas scaled +* Fix blockquote span +* Dealing with white spaces at the end of a document +* image-loader add SchemeHandler abstraction +* Add sample-latex-math module + +## v1.1.1 +* Fix OrderedListItemSpan text position (baseline) ([#55]) +* Add softBreakAddsNewLine option for SpannableConfiguration ([#54]) +* Paragraph text can now explicitly be spanned ([#58]) +
Thanks to [@c-b-h] +* Fix table border color if odd background is specified ([#56]) +* Add table customizations (even and header rows) + +[#55]: https://github.com/noties/Markwon/issues/55 +[#54]: https://github.com/noties/Markwon/issues/54 +[#58]: https://github.com/noties/Markwon/issues/58 +[#56]: https://github.com/noties/Markwon/issues/56 +[@c-b-h]: https://github.com/c-b-h + + +## v1.1.0 +* Update commonmark to 0.11.0 and android-gif to 1.2.14 +* Add syntax highlight functionality (`library-syntax` module and `markwon-syntax` artifact) +* Add headingTypeface, headingTextSizes to SpannableTheme +
Thanks to [@edenman] +* Introduce `MediaDecoder` abstraction to `image-loader` module +* Introduce `SpannableFactory` +
Thanks for idea to [@c-b-h] +* Update sample application to use syntax-highlight +* Update sample application to use clickable placeholder for GIF media + +[@edenman]: https://github.com/edenman +[@c-b-h]: https://github.com/c-b-h + + +## v1.0.6 +* Fix bullet list item size (depend on text size and not top-bottom arguments) +* Add ability to specify MovementMethod when applying markdown to a TextView +* Markdown images size is also resolved via ImageSizeResolver +* Moved `ImageSize`, `ImageSizeResolver` and `ImageSizeResolverDef` +to `ru.noties.markwon.renderer` package (one level up, previously `ru.noties.markwon.renderer.html`) + +## v1.0.5 +* Change LinkSpan to extend URLSpan. Allow default linkColor (if not set explicitly) +* Fit an image without dimensions to canvas width (and keep ratio) +* Add support for separate color for code blocks ([#37]) +
Thanks to [@Arcnor] + +[#37]: https://github.com/noties/Markwon/issues/37 +[@Arcnor]: https://github.com/Arcnor + + +## v1.0.4 +* Fixes [#28] (tables are not rendered when at the end of the markdown) +* Adds support for `indented code blocks` +
Thanks to [@dlew] + +[#28]: https://github.com/noties/Markwon/issues/ +[@dlew]: https://github.com/dlew + + +## v1.0.3 +* Fixed ordered lists (when number width is greater than block margin) + +## v1.0.2 +* Fixed additional white spaces at the end of parsed markdown +* Fixed headings with no underline (levels 1 & 2) +* Tables can have no borders + +## v1.0.1 +* Support for task-lists ([#2]) +* Spans now are applied in reverse order ([#5] [#10]) +* Added `SpannableBuilder` to follow the reverse order of spans +* Updated `commonmark-java` to `0.10.0` +* Fixes [#1] + +[#1]: https://github.com/noties/Markwon/issues/1 +[#2]: https://github.com/noties/Markwon/issues/2 +[#5]: https://github.com/noties/Markwon/issues/5 +[#10]: https://github.com/noties/Markwon/issues/10 + + +## v1.0.0 + +Initial release \ No newline at end of file diff --git a/README.md b/README.md index dd379ae3..999f7e8c 100644 --- a/README.md +++ b/README.md @@ -28,20 +28,21 @@ features listed in [commonmark-spec] are supported ## Installation -![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) +![stable](https://img.shields.io/maven-central/v/io.noties.markwon/core.svg?label=stable) +![snapshot](https://img.shields.io/nexus/s/https/oss.sonatype.org/io.noties.markwon/core.svg?label=snapshot) -```groovy -implementation "ru.noties.markwon:core:${markwonVersion}" +```kotlin +implementation "io.noties.markwon:core:${markwonVersion}" ``` -Full list of available artifacts is present in the [install section](https://noties.github.io/Markwon/docs/v3/install.html) +Full list of available artifacts is present in the [install section](https://noties.github.io/Markwon/docs/v4/install.html) of the [documentation] web-site. Please visit [documentation] web-site for further reference. -> You can find previous version of Markwon in [2.x.x](https://github.com/noties/Markwon/tree/2.x.x) branch +> You can find previous version of Markwon in [2.x.x](https://github.com/noties/Markwon/tree/2.x.x) +and [3.x.x](https://github.com/noties/Markwon/tree/3.x.x) branches ## Supported markdown features: @@ -97,15 +98,6 @@ Please visit [documentation] web-site for reference [documentation]: https://noties.github.io/Markwon ---- - -## Applications using Markwon - -* [Partiko](https://partiko.app) -* [FairNote Notepad](https://play.google.com/store/apps/details?id=com.rgiskard.fairnote) -* [Boxcryptor](https://www.boxcryptor.com) - - --- # Demo @@ -217,7 +209,6 @@ public static Parser createParser() { android:layout_margin="16dip" android:lineSpacingExtra="2dip" android:textSize="16sp" - tools:context="ru.noties.markwon.MainActivity" tools:text="yo\nman" /> @@ -296,7 +287,7 @@ Underscores (`_`) ## License ``` - Copyright 2017 Dimitry Ivanov (mail@dimitryivanov.ru) + Copyright 2019 Dimitry Ivanov (legal@noties.io) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/app/build.gradle b/app/build.gradle index c6ad59c1..33d7c8cd 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -6,7 +6,7 @@ android { buildToolsVersion config['build-tools'] defaultConfig { - applicationId "ru.noties.markwon" + applicationId "io.noties.markwon" minSdkVersion config['min-sdk'] targetSdkVersion config['target-sdk'] versionCode 1 @@ -33,8 +33,7 @@ dependencies { implementation project(':markwon-ext-tables') implementation project(':markwon-ext-tasklist') implementation project(':markwon-html') - implementation project(':markwon-image-gif') - implementation project(':markwon-image-svg') + implementation project(':markwon-image') implementation project(':markwon-syntax-highlight') deps.with { @@ -42,6 +41,8 @@ dependencies { implementation it['prism4j'] implementation it['debug'] implementation it['dagger'] + implementation it['android-svg'] + implementation it['android-gif'] } deps['annotationProcessor'].with { diff --git a/app/src/debug/java/ru/noties/markwon/debug/DebugCheckboxDrawableView.java b/app/src/debug/java/io/noties/markwon/debug/DebugCheckboxDrawableView.java similarity index 93% rename from app/src/debug/java/ru/noties/markwon/debug/DebugCheckboxDrawableView.java rename to app/src/debug/java/io/noties/markwon/debug/DebugCheckboxDrawableView.java index 4c9027cc..7a506fc8 100644 --- a/app/src/debug/java/ru/noties/markwon/debug/DebugCheckboxDrawableView.java +++ b/app/src/debug/java/io/noties/markwon/debug/DebugCheckboxDrawableView.java @@ -1,15 +1,15 @@ -package ru.noties.markwon.debug; +package io.noties.markwon.debug; import android.content.Context; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.drawable.Drawable; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import android.util.AttributeSet; import android.view.View; -import ru.noties.markwon.R; -import ru.noties.markwon.ext.tasklist.TaskListDrawable; +import io.noties.markwon.app.R; +import io.noties.markwon.ext.tasklist.TaskListDrawable; public class DebugCheckboxDrawableView extends View { diff --git a/app/src/debug/res/layout/debug_checkbox.xml b/app/src/debug/res/layout/debug_checkbox.xml index bf56ec39..3e5d19eb 100644 --- a/app/src/debug/res/layout/debug_checkbox.xml +++ b/app/src/debug/res/layout/debug_checkbox.xml @@ -4,7 +4,7 @@ android:layout_width="match_parent" android:layout_height="match_parent"> - + package="io.noties.markwon.app"> diff --git a/app/src/main/java/ru/noties/markwon/ActivityScope.java b/app/src/main/java/io/noties/markwon/app/ActivityScope.java similarity index 67% rename from app/src/main/java/ru/noties/markwon/ActivityScope.java rename to app/src/main/java/io/noties/markwon/app/ActivityScope.java index de2920a7..38f20d61 100644 --- a/app/src/main/java/ru/noties/markwon/ActivityScope.java +++ b/app/src/main/java/io/noties/markwon/app/ActivityScope.java @@ -1,4 +1,4 @@ -package ru.noties.markwon; +package io.noties.markwon.app; import javax.inject.Scope; diff --git a/app/src/main/java/ru/noties/markwon/App.java b/app/src/main/java/io/noties/markwon/app/App.java similarity index 79% rename from app/src/main/java/ru/noties/markwon/App.java rename to app/src/main/java/io/noties/markwon/app/App.java index 5c9b3157..46e15e4b 100644 --- a/app/src/main/java/ru/noties/markwon/App.java +++ b/app/src/main/java/io/noties/markwon/app/App.java @@ -1,11 +1,12 @@ -package ru.noties.markwon; +package io.noties.markwon.app; import android.app.Application; import android.content.Context; -import android.support.annotation.NonNull; -import ru.noties.debug.AndroidLogDebugOutput; -import ru.noties.debug.Debug; +import androidx.annotation.NonNull; + +import io.noties.debug.AndroidLogDebugOutput; +import io.noties.debug.Debug; public class App extends Application { diff --git a/app/src/main/java/ru/noties/markwon/AppBarItem.java b/app/src/main/java/io/noties/markwon/app/AppBarItem.java similarity index 93% rename from app/src/main/java/ru/noties/markwon/AppBarItem.java rename to app/src/main/java/io/noties/markwon/app/AppBarItem.java index bf83e658..a8b8a322 100644 --- a/app/src/main/java/ru/noties/markwon/AppBarItem.java +++ b/app/src/main/java/io/noties/markwon/app/AppBarItem.java @@ -1,10 +1,11 @@ -package ru.noties.markwon; +package io.noties.markwon.app; -import android.support.annotation.NonNull; import android.text.TextUtils; import android.view.View; import android.widget.TextView; +import androidx.annotation.NonNull; + abstract class AppBarItem { static class State { diff --git a/app/src/main/java/ru/noties/markwon/AppComponent.java b/app/src/main/java/io/noties/markwon/app/AppComponent.java similarity index 86% rename from app/src/main/java/ru/noties/markwon/AppComponent.java rename to app/src/main/java/io/noties/markwon/app/AppComponent.java index 1ff78c29..6f657b1c 100644 --- a/app/src/main/java/ru/noties/markwon/AppComponent.java +++ b/app/src/main/java/io/noties/markwon/app/AppComponent.java @@ -1,4 +1,4 @@ -package ru.noties.markwon; +package io.noties.markwon.app; import javax.inject.Singleton; diff --git a/app/src/main/java/ru/noties/markwon/AppModule.java b/app/src/main/java/io/noties/markwon/app/AppModule.java similarity index 89% rename from app/src/main/java/ru/noties/markwon/AppModule.java rename to app/src/main/java/io/noties/markwon/app/AppModule.java index 32d3e931..45673165 100644 --- a/app/src/main/java/ru/noties/markwon/AppModule.java +++ b/app/src/main/java/io/noties/markwon/app/AppModule.java @@ -1,4 +1,4 @@ -package ru.noties.markwon; +package io.noties.markwon.app; import android.content.Context; import android.content.res.Resources; @@ -12,12 +12,12 @@ import javax.inject.Singleton; import dagger.Module; import dagger.Provides; +import io.noties.markwon.syntax.Prism4jThemeDarkula; +import io.noties.markwon.syntax.Prism4jThemeDefault; import okhttp3.Cache; import okhttp3.OkHttpClient; -import ru.noties.markwon.syntax.Prism4jThemeDarkula; -import ru.noties.markwon.syntax.Prism4jThemeDefault; -import ru.noties.prism4j.Prism4j; -import ru.noties.prism4j.annotations.PrismBundle; +import io.noties.prism4j.Prism4j; +import io.noties.prism4j.annotations.PrismBundle; @Module @PrismBundle(includeAll = true) diff --git a/app/src/main/java/ru/noties/markwon/MainActivity.java b/app/src/main/java/io/noties/markwon/app/MainActivity.java similarity index 95% rename from app/src/main/java/ru/noties/markwon/MainActivity.java rename to app/src/main/java/io/noties/markwon/app/MainActivity.java index fd3965b6..c72542b3 100644 --- a/app/src/main/java/ru/noties/markwon/MainActivity.java +++ b/app/src/main/java/io/noties/markwon/app/MainActivity.java @@ -1,18 +1,20 @@ -package ru.noties.markwon; +package io.noties.markwon.app; import android.app.Activity; import android.content.Intent; import android.net.Uri; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; import android.text.Spanned; import android.view.View; import android.widget.TextView; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + import javax.inject.Inject; -import ru.noties.debug.Debug; +import io.noties.debug.Debug; +import io.noties.markwon.Markwon; public class MainActivity extends Activity { diff --git a/app/src/main/java/ru/noties/markwon/MainActivitySubcomponent.java b/app/src/main/java/io/noties/markwon/app/MainActivitySubcomponent.java similarity index 81% rename from app/src/main/java/ru/noties/markwon/MainActivitySubcomponent.java rename to app/src/main/java/io/noties/markwon/app/MainActivitySubcomponent.java index 077fcd31..24d67488 100644 --- a/app/src/main/java/ru/noties/markwon/MainActivitySubcomponent.java +++ b/app/src/main/java/io/noties/markwon/app/MainActivitySubcomponent.java @@ -1,4 +1,4 @@ -package ru.noties.markwon; +package io.noties.markwon.app; import dagger.Subcomponent; diff --git a/app/src/main/java/ru/noties/markwon/MarkdownLoader.java b/app/src/main/java/io/noties/markwon/app/MarkdownLoader.java similarity index 97% rename from app/src/main/java/ru/noties/markwon/MarkdownLoader.java rename to app/src/main/java/io/noties/markwon/app/MarkdownLoader.java index 02bb902d..db135dc4 100644 --- a/app/src/main/java/ru/noties/markwon/MarkdownLoader.java +++ b/app/src/main/java/io/noties/markwon/app/MarkdownLoader.java @@ -1,13 +1,14 @@ -package ru.noties.markwon; +package io.noties.markwon.app; import android.content.ContentResolver; import android.content.Context; import android.net.Uri; import android.os.Handler; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; import android.text.TextUtils; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; @@ -20,11 +21,11 @@ import java.util.concurrent.Future; import javax.inject.Inject; +import io.noties.debug.Debug; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response; import okhttp3.ResponseBody; -import ru.noties.debug.Debug; @ActivityScope public class MarkdownLoader { diff --git a/app/src/main/java/ru/noties/markwon/MarkdownRenderer.java b/app/src/main/java/io/noties/markwon/app/MarkdownRenderer.java similarity index 66% rename from app/src/main/java/ru/noties/markwon/MarkdownRenderer.java rename to app/src/main/java/io/noties/markwon/app/MarkdownRenderer.java index cf2ab04c..9bcb8e0f 100644 --- a/app/src/main/java/ru/noties/markwon/MarkdownRenderer.java +++ b/app/src/main/java/io/noties/markwon/app/MarkdownRenderer.java @@ -1,35 +1,38 @@ -package ru.noties.markwon; +package io.noties.markwon.app; import android.content.Context; import android.net.Uri; import android.os.Handler; import android.os.SystemClock; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; import android.text.Spanned; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + import java.util.concurrent.ExecutorService; import java.util.concurrent.Future; import javax.inject.Inject; -import ru.noties.debug.Debug; -import ru.noties.markwon.core.CorePlugin; -import ru.noties.markwon.ext.strikethrough.StrikethroughPlugin; -import ru.noties.markwon.ext.tables.TablePlugin; -import ru.noties.markwon.ext.tasklist.TaskListPlugin; -import ru.noties.markwon.gif.GifAwarePlugin; -import ru.noties.markwon.html.HtmlPlugin; -import ru.noties.markwon.image.ImagesPlugin; -import ru.noties.markwon.image.gif.GifPlugin; -import ru.noties.markwon.image.svg.SvgPlugin; -import ru.noties.markwon.syntax.Prism4jTheme; -import ru.noties.markwon.syntax.Prism4jThemeDarkula; -import ru.noties.markwon.syntax.Prism4jThemeDefault; -import ru.noties.markwon.syntax.SyntaxHighlightPlugin; -import ru.noties.markwon.urlprocessor.UrlProcessor; -import ru.noties.markwon.urlprocessor.UrlProcessorRelativeToAbsolute; -import ru.noties.prism4j.Prism4j; +import io.noties.debug.Debug; +import io.noties.markwon.AbstractMarkwonPlugin; +import io.noties.markwon.Markwon; +import io.noties.markwon.MarkwonConfiguration; +import io.noties.markwon.app.gif.GifAwarePlugin; +import io.noties.markwon.ext.strikethrough.StrikethroughPlugin; +import io.noties.markwon.ext.tables.TablePlugin; +import io.noties.markwon.ext.tasklist.TaskListPlugin; +import io.noties.markwon.html.HtmlPlugin; +import io.noties.markwon.image.ImagesPlugin; +import io.noties.markwon.image.file.FileSchemeHandler; +import io.noties.markwon.image.network.OkHttpNetworkSchemeHandler; +import io.noties.markwon.syntax.Prism4jTheme; +import io.noties.markwon.syntax.Prism4jThemeDarkula; +import io.noties.markwon.syntax.Prism4jThemeDefault; +import io.noties.markwon.syntax.SyntaxHighlightPlugin; +import io.noties.markwon.urlprocessor.UrlProcessor; +import io.noties.markwon.urlprocessor.UrlProcessorRelativeToAbsolute; +import io.noties.prism4j.Prism4j; @ActivityScope public class MarkdownRenderer { @@ -94,10 +97,17 @@ public class MarkdownRenderer { : prism4JThemeDarkula; final Markwon markwon = Markwon.builder(context) - .usePlugin(CorePlugin.create()) - .usePlugin(ImagesPlugin.createWithAssets(context)) - .usePlugin(SvgPlugin.create(context.getResources())) - .usePlugin(GifPlugin.create(false)) + .usePlugin(ImagesPlugin.create(new ImagesPlugin.ImagesConfigure() { + @Override + public void configureImages(@NonNull ImagesPlugin plugin) { + // data uri scheme handler is added automatically + // SVG & GIF will be added if required dependencies are present in the classpath + // default-media-decoder is also added automatically + plugin + .addSchemeHandler(OkHttpNetworkSchemeHandler.create()) + .addSchemeHandler(FileSchemeHandler.createWithAssets(context.getAssets())); + } + })) .usePlugin(SyntaxHighlightPlugin.create(prism4j, prism4jTheme)) .usePlugin(GifAwarePlugin.create(context)) .usePlugin(TablePlugin.create(context)) diff --git a/app/src/main/java/ru/noties/markwon/Themes.java b/app/src/main/java/io/noties/markwon/app/Themes.java similarity index 94% rename from app/src/main/java/ru/noties/markwon/Themes.java rename to app/src/main/java/io/noties/markwon/app/Themes.java index 85ab846c..14dc1f61 100644 --- a/app/src/main/java/ru/noties/markwon/Themes.java +++ b/app/src/main/java/io/noties/markwon/app/Themes.java @@ -1,8 +1,9 @@ -package ru.noties.markwon; +package io.noties.markwon.app; import android.content.Context; import android.content.SharedPreferences; -import android.support.annotation.NonNull; + +import androidx.annotation.NonNull; import javax.inject.Inject; import javax.inject.Singleton; diff --git a/app/src/main/java/ru/noties/markwon/UriProcessor.java b/app/src/main/java/io/noties/markwon/app/UriProcessor.java similarity index 64% rename from app/src/main/java/ru/noties/markwon/UriProcessor.java rename to app/src/main/java/io/noties/markwon/app/UriProcessor.java index a4fb5b85..45364c67 100644 --- a/app/src/main/java/ru/noties/markwon/UriProcessor.java +++ b/app/src/main/java/io/noties/markwon/app/UriProcessor.java @@ -1,7 +1,8 @@ -package ru.noties.markwon; +package io.noties.markwon.app; import android.net.Uri; -import android.support.annotation.NonNull; + +import androidx.annotation.NonNull; @SuppressWarnings("WeakerAccess") public interface UriProcessor { diff --git a/app/src/main/java/ru/noties/markwon/UriProcessorImpl.java b/app/src/main/java/io/noties/markwon/app/UriProcessorImpl.java similarity index 91% rename from app/src/main/java/ru/noties/markwon/UriProcessorImpl.java rename to app/src/main/java/io/noties/markwon/app/UriProcessorImpl.java index 03d29353..a4bb3137 100644 --- a/app/src/main/java/ru/noties/markwon/UriProcessorImpl.java +++ b/app/src/main/java/io/noties/markwon/app/UriProcessorImpl.java @@ -1,7 +1,8 @@ -package ru.noties.markwon; +package io.noties.markwon.app; import android.net.Uri; -import android.support.annotation.NonNull; + +import androidx.annotation.NonNull; import java.util.List; @@ -32,7 +33,7 @@ class UriProcessorImpl implements UriProcessor { .fragment(uri.getFragment()) .query(uri.getQuery()); - for (String segment: segments) { + for (String segment : segments) { final String part; if ("blob".equals(segment)) { part = "raw"; diff --git a/app/src/main/java/ru/noties/markwon/UrlProcessorInitialReadme.java b/app/src/main/java/io/noties/markwon/app/UrlProcessorInitialReadme.java similarity index 78% rename from app/src/main/java/ru/noties/markwon/UrlProcessorInitialReadme.java rename to app/src/main/java/io/noties/markwon/app/UrlProcessorInitialReadme.java index d9690574..571bb395 100644 --- a/app/src/main/java/ru/noties/markwon/UrlProcessorInitialReadme.java +++ b/app/src/main/java/io/noties/markwon/app/UrlProcessorInitialReadme.java @@ -1,11 +1,12 @@ -package ru.noties.markwon; +package io.noties.markwon.app; import android.net.Uri; -import android.support.annotation.NonNull; import android.text.TextUtils; -import ru.noties.markwon.urlprocessor.UrlProcessor; -import ru.noties.markwon.urlprocessor.UrlProcessorRelativeToAbsolute; +import androidx.annotation.NonNull; + +import io.noties.markwon.urlprocessor.UrlProcessor; +import io.noties.markwon.urlprocessor.UrlProcessorRelativeToAbsolute; class UrlProcessorInitialReadme implements UrlProcessor { diff --git a/app/src/main/java/ru/noties/markwon/Views.java b/app/src/main/java/io/noties/markwon/app/Views.java similarity index 83% rename from app/src/main/java/ru/noties/markwon/Views.java rename to app/src/main/java/io/noties/markwon/app/Views.java index 3c172e4b..587b2c9f 100644 --- a/app/src/main/java/ru/noties/markwon/Views.java +++ b/app/src/main/java/io/noties/markwon/app/Views.java @@ -1,9 +1,10 @@ -package ru.noties.markwon; +package io.noties.markwon.app; -import android.support.annotation.IntDef; -import android.support.annotation.NonNull; import android.view.View; +import androidx.annotation.IntDef; +import androidx.annotation.NonNull; + @SuppressWarnings("WeakerAccess") public abstract class Views { diff --git a/app/src/main/java/ru/noties/markwon/gif/GifAwareAsyncDrawable.java b/app/src/main/java/io/noties/markwon/app/gif/GifAwareAsyncDrawable.java similarity index 83% rename from app/src/main/java/ru/noties/markwon/gif/GifAwareAsyncDrawable.java rename to app/src/main/java/io/noties/markwon/app/gif/GifAwareAsyncDrawable.java index b5ba34ce..58c0bad3 100644 --- a/app/src/main/java/ru/noties/markwon/gif/GifAwareAsyncDrawable.java +++ b/app/src/main/java/io/noties/markwon/app/gif/GifAwareAsyncDrawable.java @@ -1,15 +1,16 @@ -package ru.noties.markwon.gif; +package io.noties.markwon.app.gif; import android.graphics.Canvas; import android.graphics.drawable.Drawable; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +import io.noties.markwon.image.AsyncDrawable; +import io.noties.markwon.image.AsyncDrawableLoader; +import io.noties.markwon.image.ImageSize; +import io.noties.markwon.image.ImageSizeResolver; import pl.droidsonroids.gif.GifDrawable; -import ru.noties.markwon.image.AsyncDrawableLoader; -import ru.noties.markwon.image.ImageSize; -import ru.noties.markwon.image.ImageSizeResolver; -import ru.noties.markwon.image.AsyncDrawable; public class GifAwareAsyncDrawable extends AsyncDrawable { diff --git a/app/src/main/java/ru/noties/markwon/gif/GifAwarePlugin.java b/app/src/main/java/io/noties/markwon/app/gif/GifAwarePlugin.java similarity index 74% rename from app/src/main/java/ru/noties/markwon/gif/GifAwarePlugin.java rename to app/src/main/java/io/noties/markwon/app/gif/GifAwarePlugin.java index 89e49384..30b33f5b 100644 --- a/app/src/main/java/ru/noties/markwon/gif/GifAwarePlugin.java +++ b/app/src/main/java/io/noties/markwon/app/gif/GifAwarePlugin.java @@ -1,21 +1,20 @@ -package ru.noties.markwon.gif; +package io.noties.markwon.app.gif; import android.content.Context; -import android.support.annotation.NonNull; import android.widget.TextView; +import androidx.annotation.NonNull; + import org.commonmark.node.Image; -import ru.noties.markwon.AbstractMarkwonPlugin; -import ru.noties.markwon.MarkwonConfiguration; -import ru.noties.markwon.MarkwonSpansFactory; -import ru.noties.markwon.R; -import ru.noties.markwon.RenderProps; -import ru.noties.markwon.SpanFactory; -import ru.noties.markwon.image.AsyncDrawableSpan; -import ru.noties.markwon.image.ImageProps; -import ru.noties.markwon.image.ImagesPlugin; -import ru.noties.markwon.priority.Priority; +import io.noties.markwon.AbstractMarkwonPlugin; +import io.noties.markwon.MarkwonConfiguration; +import io.noties.markwon.MarkwonSpansFactory; +import io.noties.markwon.RenderProps; +import io.noties.markwon.SpanFactory; +import io.noties.markwon.app.R; +import io.noties.markwon.image.AsyncDrawableSpan; +import io.noties.markwon.image.ImageProps; public class GifAwarePlugin extends AbstractMarkwonPlugin { @@ -59,12 +58,6 @@ public class GifAwarePlugin extends AbstractMarkwonPlugin { }); } - @NonNull - @Override - public Priority priority() { - return Priority.after(ImagesPlugin.class); - } - @Override public void afterSetText(@NonNull TextView textView) { processor.process(textView); diff --git a/app/src/main/java/ru/noties/markwon/gif/GifPlaceholder.java b/app/src/main/java/io/noties/markwon/app/gif/GifPlaceholder.java similarity index 91% rename from app/src/main/java/ru/noties/markwon/gif/GifPlaceholder.java rename to app/src/main/java/io/noties/markwon/app/gif/GifPlaceholder.java index 7d6dcbe1..8417545b 100644 --- a/app/src/main/java/ru/noties/markwon/gif/GifPlaceholder.java +++ b/app/src/main/java/io/noties/markwon/app/gif/GifPlaceholder.java @@ -1,4 +1,4 @@ -package ru.noties.markwon.gif; +package io.noties.markwon.app.gif; import android.graphics.Canvas; import android.graphics.ColorFilter; @@ -6,9 +6,10 @@ import android.graphics.Paint; import android.graphics.PixelFormat; import android.graphics.Rect; import android.graphics.drawable.Drawable; -import android.support.annotation.ColorInt; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; + +import androidx.annotation.ColorInt; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; public class GifPlaceholder extends Drawable { diff --git a/app/src/main/java/ru/noties/markwon/gif/GifProcessor.java b/app/src/main/java/io/noties/markwon/app/gif/GifProcessor.java similarity index 96% rename from app/src/main/java/ru/noties/markwon/gif/GifProcessor.java rename to app/src/main/java/io/noties/markwon/app/gif/GifProcessor.java index 8cdb1da5..59d4dfef 100644 --- a/app/src/main/java/ru/noties/markwon/gif/GifProcessor.java +++ b/app/src/main/java/io/noties/markwon/app/gif/GifProcessor.java @@ -1,15 +1,16 @@ -package ru.noties.markwon.gif; +package io.noties.markwon.app.gif; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; import android.text.Spannable; import android.text.Spanned; import android.text.style.ClickableSpan; import android.view.View; import android.widget.TextView; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +import io.noties.markwon.image.AsyncDrawableSpan; import pl.droidsonroids.gif.GifDrawable; -import ru.noties.markwon.image.AsyncDrawableSpan; public abstract class GifProcessor { diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 97c5fb1b..da49a67b 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -8,11 +8,11 @@ android:id="@+id/scroll_view" android:layout_width="match_parent" android:layout_height="match_parent" - android:padding="16dip" - android:clipToPadding="false" + android:layout_marginTop="?android:attr/actionBarSize" android:clipChildren="false" - android:scrollbarStyle="outsideOverlay" - android:layout_marginTop="?android:attr/actionBarSize"> + android:clipToPadding="false" + android:padding="16dip" + android:scrollbarStyle="outsideOverlay"> diff --git a/build.gradle b/build.gradle index 63782269..8c49f472 100644 --- a/build.gradle +++ b/build.gradle @@ -4,8 +4,8 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.3.2' - classpath 'com.github.ben-manes:gradle-versions-plugin:0.20.0' + classpath 'com.android.tools.build:gradle:3.4.1' + classpath 'com.github.ben-manes:gradle-versions-plugin:0.21.0' } } @@ -29,8 +29,8 @@ task clean(type: Delete) { delete rootProject.buildDir } -task wrapper(type: Wrapper) { - gradleVersion '4.10.2' +wrapper { + gradleVersion '5.1.1' distributionType 'all' } @@ -53,29 +53,29 @@ ext { 'push-aar-gradle': 'https://raw.githubusercontent.com/noties/gradle-mvn-push/master/gradle-mvn-push-aar.gradle' ] - final def supportVersion = '28.0.0' final def commonMarkVersion = '0.12.1' final def daggerVersion = '2.10' deps = [ - 'support-annotations' : "com.android.support:support-annotations:$supportVersion", - 'support-app-compat' : "com.android.support:appcompat-v7:$supportVersion", - 'support-recycler-view' : "com.android.support:recyclerview-v7:$supportVersion", + 'x-annotations' : 'androidx.annotation:annotation:1.1.0', + 'x-recycler-view' : 'androidx.recyclerview:recyclerview:1.0.0', 'commonmark' : "com.atlassian.commonmark:commonmark:$commonMarkVersion", 'commonmark-strikethrough': "com.atlassian.commonmark:commonmark-ext-gfm-strikethrough:$commonMarkVersion", 'commonmark-table' : "com.atlassian.commonmark:commonmark-ext-gfm-tables:$commonMarkVersion", - 'android-svg' : 'com.caverock:androidsvg:1.2.1', + 'android-svg' : 'com.caverock:androidsvg:1.4', 'android-gif' : 'pl.droidsonroids.gif:android-gif-drawable:1.2.14', 'jlatexmath-android' : 'ru.noties:jlatexmath-android:0.1.0', 'okhttp' : 'com.squareup.okhttp3:okhttp:3.9.0', - 'prism4j' : 'ru.noties:prism4j:1.1.0', - 'debug' : 'ru.noties:debug:3.0.0@jar', - 'adapt' : 'ru.noties:adapt:1.1.0', - 'dagger' : "com.google.dagger:dagger:$daggerVersion" + 'prism4j' : 'io.noties:prism4j:2.0.0', + 'debug' : 'io.noties:debug:5.0.0@jar', + 'adapt' : 'io.noties:adapt:2.0.0', + 'dagger' : "com.google.dagger:dagger:$daggerVersion", + 'picasso' : 'com.squareup.picasso:picasso:2.71828', + 'glide' : 'com.github.bumptech.glide:glide:4.9.0' ] deps['annotationProcessor'] = [ - 'prism4j-bundler': 'ru.noties:prism4j-bundler:1.1.0', + 'prism4j-bundler': 'io.noties:prism4j-bundler:2.0.0', 'dagger-compiler': "com.google.dagger:dagger-compiler:$daggerVersion" ] diff --git a/docs/.vuepress/.artifacts.js b/docs/.vuepress/.artifacts.js index 2a1c3f43..62c52ab8 100644 --- a/docs/.vuepress/.artifacts.js +++ b/docs/.vuepress/.artifacts.js @@ -1,4 +1,4 @@ // this is a generated file, do not modify. To update it run 'collectArtifacts.js' script -const artifacts = [{"id":"core","name":"Core","group":"ru.noties.markwon","description":"Core Markwon artifact that includes basic markdown parsing and rendering"},{"id":"ext-latex","name":"LaTeX","group":"ru.noties.markwon","description":"Extension to add LaTeX formulas to Markwon markdown"},{"id":"ext-strikethrough","name":"Strikethrough","group":"ru.noties.markwon","description":"Extension to add strikethrough markup to Markwon markdown"},{"id":"ext-tables","name":"Tables","group":"ru.noties.markwon","description":"Extension to add tables markup (GFM) to Markwon markdown"},{"id":"ext-tasklist","name":"Task List","group":"ru.noties.markwon","description":"Extension to add task lists (GFM) to Markwon markdown"},{"id":"html","name":"HTML","group":"ru.noties.markwon","description":"Provides HTML parsing functionality"},{"id":"image-gif","name":"Image GIF","group":"ru.noties.markwon","description":"Adds GIF media support to Markwon markdown"},{"id":"image-okhttp","name":"Image OkHttp","group":"ru.noties.markwon","description":"Adds OkHttp client to retrieve images data from network"},{"id":"image-svg","name":"Image SVG","group":"ru.noties.markwon","description":"Adds SVG media support to Markwon markdown"},{"id":"recycler","name":"Recycler","group":"ru.noties.markwon","description":"Provides RecyclerView.Adapter to display Markwon markdown"},{"id":"recycler-table","name":"Recycler Table","group":"ru.noties.markwon","description":"Provides MarkwonAdapter.Entry to render TableBlocks inside Android-native TableLayout widget"},{"id":"syntax-highlight","name":"Syntax Highlight","group":"ru.noties.markwon","description":"Add syntax highlight to Markwon markdown via Prism4j library"}]; +const artifacts = [{"id":"core","name":"Core","group":"io.noties.markwon","description":"Core Markwon artifact that includes basic markdown parsing and rendering"},{"id":"ext-latex","name":"LaTeX","group":"io.noties.markwon","description":"Extension to add LaTeX formulas to Markwon markdown"},{"id":"ext-strikethrough","name":"Strikethrough","group":"io.noties.markwon","description":"Extension to add strikethrough markup to Markwon markdown"},{"id":"ext-tables","name":"Tables","group":"io.noties.markwon","description":"Extension to add tables markup (GFM) to Markwon markdown"},{"id":"ext-tasklist","name":"Task List","group":"io.noties.markwon","description":"Extension to add task lists (GFM) to Markwon markdown"},{"id":"html","name":"HTML","group":"io.noties.markwon","description":"Provides HTML parsing functionality"},{"id":"image","name":"Image","group":"io.noties.markwon","description":"Markwon image loading module (with optional GIF and SVG support)"},{"id":"image-glide","name":"Image Glide","group":"io.noties.markwon","description":"Markwon image loading module (based on Glide library)"},{"id":"image-picasso","name":"Image Picasso","group":"io.noties.markwon","description":"Markwon image loading module (based on Picasso library)"},{"id":"linkify","name":"Linkify","group":"io.noties.markwon","description":"Markwon plugin to linkify text (based on Android Linkify)"},{"id":"recycler","name":"Recycler","group":"io.noties.markwon","description":"Provides RecyclerView.Adapter to display Markwon markdown"},{"id":"recycler-table","name":"Recycler Table","group":"io.noties.markwon","description":"Provides MarkwonAdapter.Entry to render TableBlocks inside Android-native TableLayout widget"},{"id":"simple-ext","name":"Simple Extension","group":"io.noties.markwon","description":"Custom extension based on simple delimiter usage"},{"id":"syntax-highlight","name":"Syntax Highlight","group":"io.noties.markwon","description":"Add syntax highlight to Markwon markdown via Prism4j library"}]; export { artifacts }; diff --git a/docs/.vuepress/.artifacts.v3.js b/docs/.vuepress/.artifacts.v3.js new file mode 100644 index 00000000..2a1c3f43 --- /dev/null +++ b/docs/.vuepress/.artifacts.v3.js @@ -0,0 +1,4 @@ + +// this is a generated file, do not modify. To update it run 'collectArtifacts.js' script +const artifacts = [{"id":"core","name":"Core","group":"ru.noties.markwon","description":"Core Markwon artifact that includes basic markdown parsing and rendering"},{"id":"ext-latex","name":"LaTeX","group":"ru.noties.markwon","description":"Extension to add LaTeX formulas to Markwon markdown"},{"id":"ext-strikethrough","name":"Strikethrough","group":"ru.noties.markwon","description":"Extension to add strikethrough markup to Markwon markdown"},{"id":"ext-tables","name":"Tables","group":"ru.noties.markwon","description":"Extension to add tables markup (GFM) to Markwon markdown"},{"id":"ext-tasklist","name":"Task List","group":"ru.noties.markwon","description":"Extension to add task lists (GFM) to Markwon markdown"},{"id":"html","name":"HTML","group":"ru.noties.markwon","description":"Provides HTML parsing functionality"},{"id":"image-gif","name":"Image GIF","group":"ru.noties.markwon","description":"Adds GIF media support to Markwon markdown"},{"id":"image-okhttp","name":"Image OkHttp","group":"ru.noties.markwon","description":"Adds OkHttp client to retrieve images data from network"},{"id":"image-svg","name":"Image SVG","group":"ru.noties.markwon","description":"Adds SVG media support to Markwon markdown"},{"id":"recycler","name":"Recycler","group":"ru.noties.markwon","description":"Provides RecyclerView.Adapter to display Markwon markdown"},{"id":"recycler-table","name":"Recycler Table","group":"ru.noties.markwon","description":"Provides MarkwonAdapter.Entry to render TableBlocks inside Android-native TableLayout widget"},{"id":"syntax-highlight","name":"Syntax Highlight","group":"ru.noties.markwon","description":"Add syntax highlight to Markwon markdown via Prism4j library"}]; +export { artifacts }; diff --git a/docs/.vuepress/components/ArtifactPicker.vue b/docs/.vuepress/components/ArtifactPicker.vue index 453b1cd2..1c5a9ca8 100644 --- a/docs/.vuepress/components/ArtifactPicker.vue +++ b/docs/.vuepress/components/ArtifactPicker.vue @@ -29,7 +29,7 @@ + + \ No newline at end of file diff --git a/docs/.vuepress/components/AwesomeGroup.vue b/docs/.vuepress/components/AwesomeGroup.vue new file mode 100644 index 00000000..1399ffaf --- /dev/null +++ b/docs/.vuepress/components/AwesomeGroup.vue @@ -0,0 +1,57 @@ + + + + + + + diff --git a/docs/.vuepress/components/MavenBadge4.vue b/docs/.vuepress/components/MavenBadge4.vue new file mode 100644 index 00000000..4a8354cd --- /dev/null +++ b/docs/.vuepress/components/MavenBadge4.vue @@ -0,0 +1,24 @@ + + + + diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index 8de47eef..de897e67 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -12,16 +12,16 @@ module.exports = { ], themeConfig: { nav: [ - { text: 'Install', link: '/docs/v3/install.md' }, - { text: 'Changelog', link: '/CHANGELOG.md' }, + { text: 'Install', link: '/docs/v4/install.md' }, { text: 'API Version', items: [ - { text: 'Current (3.x.x)', link: '/' }, + { 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: 'Sandbox', link: '/sandbox.md' }, + { text: 'Changelog', link: 'https://github.com/noties/Markwon/blob/master/CHANGELOG.md' }, { text: 'Github', link: 'https://github.com/noties/Markwon' } ], sidebar: { @@ -36,8 +36,8 @@ module.exports = { '/docs/v2/html.md', '/docs/v2/view.md' ], - '/': [ - '', + '/docs/v3': [ + '/docs/v3/install.md', { title: 'Core', collapsable: false, @@ -67,7 +67,40 @@ module.exports = { '/docs/v3/recycler-table/', '/docs/v3/syntax-highlight/', '/docs/v3/migration-2-3.md' - ] + ], + '/': [ + '', + { + title: 'Core', + collapsable: false, + children: [ + '/docs/v4/core/getting-started.md', + '/docs/v4/core/plugins.md', + '/docs/v4/core/registry.md', + '/docs/v4/core/theme.md', + '/docs/v4/core/configuration.md', + '/docs/v4/core/visitor.md', + '/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/ext-latex/', + '/docs/v4/ext-strikethrough/', + '/docs/v4/ext-tables/', + '/docs/v4/ext-tasklist/', + '/docs/v4/html/', + '/docs/v4/image/', + '/docs/v4/image-glide/', + '/docs/v4/image-picasso/', + '/docs/v4/linkify/', + '/docs/v4/recycler/', + '/docs/v4/recycler-table/', + '/docs/v4/simple-ext/', + '/docs/v4/syntax-highlight/', + '/docs/v4/recipes.md' + ], }, sidebarDepth: 2, lastUpdated: true diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md deleted file mode 100644 index ce8c7278..00000000 --- a/docs/CHANGELOG.md +++ /dev/null @@ -1,132 +0,0 @@ -# Changelog - -# 3.0.1 -* Add `AsyncDrawableLoader.Builder#implementation` method () -* AsyncDrawable allow placeholder to have independent size () -* `addFactory` method for MarkwonSpansFactory -* Add optional spans for list blocks (bullet and ordered) -* AsyncDrawable placeholder bounds fix -* SpannableBuilder setSpans allow array of arrays -* Add `requireFactory` method to MarkwonSpansFactory -* Add DrawableUtils - -## 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 () -* Update SpannableTheme to use Px instead of Dimension annotation -* Allow TaskListSpan isDone mutation -* Updated commonmark-java to 0.12.1 -* Add OrderedListItemSpan measure utility method () -* Add SpannableBuilder#getSpans method -* Fix DataUri scheme handler in image-loader () -* Introduced a "copy" builder for SpannableThem
Thanks - -## 2.0.0 -* Add `html-parser-api` and `html-parser-impl` modules -* Add `HtmlEmptyTagReplacement` -* Implement Appendable and CharSequence in SpannableBuilder -* Renamed library modules to reflect maven artifact names -* Rename `markwon-syntax` to `markwon-syntax-highlight` -* Add HtmlRenderer asbtraction -* Add CssInlineStyleParser -* Fix Theme#listItemColor and OL -* Fix task list block parser to revert parsing state when line is not matching -* Defined test format files -* image-loader add datauri parser -* image-loader add support for inline data uri image references -* Add travis configuration -* Fix image with width greater than canvas scaled -* Fix blockquote span -* Dealing with white spaces at the end of a document -* image-loader add SchemeHandler abstraction -* Add sample-latex-math module - -## v1.1.1 -* Fix OrderedListItemSpan text position (baseline) () -* Add softBreakAddsNewLine option for SpannableConfiguration () -* Paragraph text can now explicitly be spanned ()
Thanks to -* Fix table border color if odd background is specified () -* Add table customizations (even and header rows) - -## v1.1.0 -* Update commonmark to 0.11.0 and android-gif to 1.2.14 -* Add syntax highlight functionality (`library-syntax` module and `markwon-syntax` artifact) -* Add headingTypeface, headingTextSizes to SpannableTheme
Thanks to -* Introduce `MediaDecoder` abstraction to `image-loader` module -* Introduce `SpannableFactory`
Thanks for idea to -* Update sample application to use syntax-highlight -* Update sample application to use clickable placeholder for GIF media - -## v1.0.6 -* Fix bullet list item size (depend on text size and not top-bottom arguments) -* Add ability to specify MovementMethod when applying markdown to a TextView -* Markdown images size is also resolved via ImageSizeResolver -* Moved `ImageSize`, `ImageSizeResolver` and `ImageSizeResolverDef` -to `ru.noties.markwon.renderer` package (one level up, previously `ru.noties.markwon.renderer.html`) - -## v1.0.5 -* Change LinkSpan to extend URLSpan. Allow default linkColor (if not set explicitly) -* Fit an image without dimensions to canvas width (and keep ratio) -* Add support for separate color for code blocks ()
Thanks to - -## v1.0.4 -* Fixes (tables are not rendered when at the end of the markdown) -* Adds support for `indented code blocks`
Thanks to - -## v1.0.3 -* Fixed ordered lists (when number width is greater than block margin) - -## v1.0.2 -* Fixed additional white spaces at the end of parsed markdown -* Fixed headings with no underline (levels 1 & 2) -* Tables can have no borders - -## v1.0.1 -* Support for task-lists () -* Spans now are applied in reverse order ( ) -* Added `SpannableBuilder` to follow the reverse order of spans -* Updated `commonmark-java` to `0.10.0` -* Fixes - -## v1.0.0 - -Initial release \ No newline at end of file diff --git a/docs/README.md b/docs/README.md index 2f6d8e5a..abab2311 100644 --- a/docs/README.md +++ b/docs/README.md @@ -5,7 +5,7 @@ title: 'Introduction' 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) +[![markwon](https://img.shields.io/maven-central/v/io.noties.markwon/core.svg?label=markwon)](http://search.maven.org/#search|ga|1|g%3A%22io.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 @@ -27,17 +27,17 @@ listed in are supported (including support for * * Strong emphasis (`**`, `__`) * Headers (`#{1,6}`) * Links (`[]()` && `[][]`) -* [Images](/docs/v3/core/images.md) +* [Images](/docs/v4/image/) * 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/) +* [Strike-through](/docs/v4/ext-strikethrough/) (`~~`) +* [Tables](/docs/v4/ext-tables/) (*with limitations*) +* [Syntax highlight](/docs/v4/syntax-highlight/) +* [LaTeX](/docs/v4/ext-latex/) formulas +* [HTML](/docs/v4/html/) * Emphasis (``, ``, ``, ``) * Strong emphasis (``, ``) * SuperScript (``) @@ -49,9 +49,9 @@ listed in are supported (including support for * * 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/core/html-renderer.md) -* [Task lists](/docs/v3/ext-tasklist/): + * there is support to render any HTML/XML tag, but it will require to create a special `TagHandler`, + more information can be found in [HTML section](/docs/v4/html/#taghandler) +* [Task lists](/docs/v4/ext-tasklist/):