private boolean handleSpan(TextCursor cursor, int blockEnd, ArrayList<MDText> elements) {
        if (mode != MODE_ONLY_LINKS) {
            int spanStart = findSpanStart(cursor, blockEnd);
            if (spanStart >= 0) {
                char span = cursor.text.charAt(spanStart);
                int spanEnd = findSpanEnd(cursor, spanStart, blockEnd, span);
                if (spanEnd >= 0) {

                    // Handling next elements before span
                    handleUrls(cursor, spanStart, elements);

                    // Increment offset before processing internal spans
                    cursor.currentOffset++;

                    // Building child spans
                    MDText[] spanElements = handleSpans(cursor, spanEnd - 1);

                    // End of search: move cursor after span
                    cursor.currentOffset = spanEnd;

                    MDSpan spanElement = new MDSpan(
                            span == '*' ? MDSpan.TYPE_BOLD : MDSpan.TYPE_ITALIC,
                            spanElements);

                    elements.add(spanElement);

                    return true;
                }
            }
        }

        handleUrls(cursor, blockEnd, elements);

        return false;
    }
private boolean handleSpan ( TextCursor cursor , int blockEnd , ArrayList < MDText > elements ) { if ( mode != MODE_ONLY_LINKS ) { int spanStart = findSpanStart ( cursor , blockEnd ) ; if ( spanStart >= 0 ) { char span = cursor . text . charAt ( spanStart ) ; int spanEnd = findSpanEnd ( cursor , spanStart , blockEnd , span ) ; if ( spanEnd >= 0 ) { handleUrls ( cursor , spanStart , elements ) ; cursor . currentOffset ++ ; MDText [ ] spanElements = handleSpans ( cursor , spanEnd - 1 ) ; cursor . currentOffset = spanEnd ; MDSpan spanElement = new MDSpan ( span == '*' ? MDSpan . TYPE_BOLD : MDSpan . TYPE_ITALIC , spanElements ) ; elements . add ( spanElement ) ; return true ; } } } handleUrls ( cursor , blockEnd , elements ) ; return false ; }
Handling span

@param cursor   text cursor
@param blockEnd span search limit
@param elements current elements
@return is