Markwon/sample-custom-extension
Dimitry 7c7b1f59a8
V1.1.0 (#53)
* Update build configuration

* Update commonmark to 0.11.0 and android-gif to 1.2.14

* Add  module `library-syntax`

* Add default prism4j theme implementation

* Add syntax highlight to sample app

* Update syntax highlight to use SpannableStringBuilder

* Working with syntax rendering

* Add darkula theme to syntax highlight

* Add  attribute for image-loader module

* Update version to 1.1.0-SNAPSHOT

* Updating build configuration for snapshot publish

* Add headingTypeface, headingTextSizes to SpannableTheme (#51)

* Add headingTypeface to SpannableTheme, use a custom heading typeface in the sample app

* Add headingTextSizes

* Switching to headingTextSizeMultipliers, adding validating annotations, adding example

* Consolidate logic, add crash if header index is out of bounds

* Add small version clarifications

* Introduce MediaDecoder abstraction for image-loader module

* Switch to use SpannableFactory

* Switch to use SpannableFactory for html parsing

* Update sample application to add play-pause functionality for gifs

* Small cleanup

* Update prism4j version 1.1.0

* Update build configuration

* Add README to library-syntax module

* Update README
2018-07-30 15:19:42 +02:00
..
2018-07-30 15:19:42 +02:00
2018-02-16 18:19:38 +03:00
2018-02-16 18:19:38 +03:00

Custom extension

This module provides a simple implementation for icons that are bundled in your application resources using custom DelimiterProcessor. It can be used as a reference when dealing with new functionality based on delimiters.

# Hello @ic-android-black-24

**Please** click @ic-home-green-24 (home icon) if you want to go home.

Here we will substitute elements starting with @ic- for icons that we have in our resources:

  • @ic-android-black-24 -> R.drawable.ic_android_black_24dp
  • @ic-home-green-24 -> R.drawable.ic_home_green_24dp

In order to provide reliable parsing we need to have delimiters around desired content. So, @ic-home-green-24 would become @ic-home-green-24@. This is current limitation of commonmark-java library that Markwon uses underneath. There is an ongoing issue that might change this in future thought.

But as we known the pattern beforehand it's pretty easy to pre-process raw markdown and make it the way we want it. Please refer to IconProcessor#process method for the reference.

So, the our steps would be:

  • prepare raw markdown (wrap icons with @ if it's not already)
  • construct a Parser with our registered delimiter processor
  • parse markdown and obtain a Node
  • create a node visitor that will additionally visit custom node (IconNode)
  • use markdown