public final static int readMdLink ( final StringBuilder out , final String in , final int start ) { int pos = start ; int counter = 1 ; while ( pos < in . length ( ) ) { final char ch = in . charAt ( pos ) ; if ( ch == ' ' && pos + 1 < in . length ( ) ) { pos = escape ( out , in . charAt ( pos + 1 ) , pos ) ; } else { boolean endReached = false ; switch ( ch ) { case ' ' : counter ++ ; break ; case ' ' : if ( counter == 1 ) { endReached = true ; } break ; case ' ' : counter -- ; if ( counter == 0 ) { endReached = true ; } break ; } if ( endReached ) { break ; } out . append ( ch ) ; } pos ++ ; } return ( pos == in . length ( ) ) ? - 1 : pos ; }
Reads a markdown link .