diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index 98885d7a..aa08ea90 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -41,6 +41,7 @@ module.exports = { '', { title: 'Core', + collapsable: false, children: [ '/docs/core/getting-started.md', '/docs/core/plugins.md', @@ -60,19 +61,15 @@ module.exports = { '/docs/ext-tasklist/', { title: 'HTML', + collapsable: false, children: [ '/docs/html/', '/docs/html/custom-tag-handler.md' ] }, - { - title: 'Image', - children: [ - '/docs/image/gif.md', - '/docs/image/okhttp.md', - '/docs/image/svg.md' - ] - }, + '/docs/image/gif.md', + '/docs/image/okhttp.md', + '/docs/image/svg.md', '/docs/recycler/', '/docs/syntax-highlight/', '/docs/migration-2-3.md' diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 09a2c676..1ff81aa1 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,6 +1,19 @@ # Changelog -# 2.0.0 +# 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 diff --git a/docs/docs/core/getting-started.md b/docs/docs/core/getting-started.md index 75b8cf71..26bc5137 100644 --- a/docs/docs/core/getting-started.md +++ b/docs/docs/core/getting-started.md @@ -59,50 +59,7 @@ Toast.makeText(context, markdown, Toast.LENGTH_LONG).show(); ## No magic one -So, what happens _internally_ when there is a `markwon#setMarkdown(TextView,String)` call? -Please note that this is mere representaion of what happens underneath and a caller -would likely never has to deal with these method calls directly. It still valuable -to understand how things are working: - -```java -// `Markwon#create` implicitly uses CorePlugin -final Markwon markwon = Markwon.builder(context) - .usePlugin(CorePlugin.create()) - .build(); - -// each plugin will configure resulting Markwon instance -// we will cover it in plugins section of documentation - -// warning: pseudo-code - -// 0. each plugin will be called to _pre-process_ raw input markdown -rawInput = plugins.reduce(rawInput, (input, plugin) -> plugin.processMarkdown(input)); - -// 1. after input is processed it's being parsed to a Node -node = parser.parse(rawInput); - -// 2. each plugin will be able to inspect or manipulate resulting Node -// before rendering -plugins.forEach(plugin -> plugin.beforeRender(node)); - -// 3. node is being visited by a visitor -node.accept(visitor); - -// 4. each plugin will be called after node is being visited (aka rendered) -plugins.forEach(plugin -> plugin.afterRender(node, visitor)); - -// 5. styled markdown ready at this point -final Spanned markdown = visitor.markdown(); - -// 6. each plugin will be called before styled markdown is applied to a TextView -plugins.forEach(plugin -> plugin.beforeSetText(textView, markdown)); - -// 7. markdown is applied to a TextView -textView.setText(markdown); - -// 8. each plugin will be called after markdown is applied to a TextView -plugins.forEach(plugin -> plugin.afterSetText(textView)); -``` - -As you can see a `plugin` is what lifts the most weight. We will cover -plugins next. +This section is kept due to historical reasons. Starting with version +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. +Head to the [next section](/docs/core/plugins.md) to know more. diff --git a/docs/docs/core/plugins.md b/docs/docs/core/plugins.md index 1ea64d07..e054d108 100644 --- a/docs/docs/core/plugins.md +++ b/docs/docs/core/plugins.md @@ -421,4 +421,47 @@ final Markwon markwon = Markwon.builder(context) Please note that unlike `#beforeSetText`, `#afterSetText` won't receive `Spanned` markdown. This happens because at this point spans must be queried directly from a TextView. -::: \ No newline at end of file +::: + +## What happens underneath + +Here is an approximation of how a `Markwon` instance will handle plugins: + +```java +// `Markwon#create` implicitly uses CorePlugin +final Markwon markwon = Markwon.builder(context) + .usePlugin(CorePlugin.create()) + .build(); + +// warning: pseudo-code + +// 0. each plugin will be called to _pre-process_ raw input markdown +rawInput = plugins.reduce(rawInput, (input, plugin) -> plugin.processMarkdown(input)); + +// 1. after input is processed it's being parsed to a Node +node = parser.parse(rawInput); + +// 2. each plugin will be able to inspect or manipulate resulting Node +// before rendering +plugins.forEach(plugin -> plugin.beforeRender(node)); + +// 3. node is being visited by a visitor +node.accept(visitor); + +// 4. each plugin will be called after node is being visited (aka rendered) +plugins.forEach(plugin -> plugin.afterRender(node, visitor)); + +// 5. styled markdown ready at this point +final Spanned markdown = visitor.markdown(); + +// NB, points 6-8 are applied **only** if markdown is set to a TextView + +// 6. each plugin will be called before styled markdown is applied to a TextView +plugins.forEach(plugin -> plugin.beforeSetText(textView, markdown)); + +// 7. markdown is applied to a TextView +textView.setText(markdown); + +// 8. each plugin will be called after markdown is applied to a TextView +plugins.forEach(plugin -> plugin.afterSetText(textView)); +``` \ No newline at end of file diff --git a/docs/docs/v2/theme.md b/docs/docs/v2/theme.md index 269155fe..617b7e47 100644 --- a/docs/docs/v2/theme.md +++ b/docs/docs/v2/theme.md @@ -3,7 +3,7 @@ # Theme Here is the list of properties that can be configured via `SpannableTheme#builder` factory -method. If you wish to control what is out of this list, you can use [SpannableFactory](/docs/factory.md) +method. If you wish to control what 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. * factory methods