* Initialized custom extension module * Upgraded android gradle plugin to 3.0.1 * Shaping up the custom extension module * Added README to module * Small improvement for IconVisitor (added color null check)
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