MakwonReducer filter out LinkReferenceDefinition
This commit is contained in:
		
							parent
							
								
									1a90f1e609
								
							
						
					
					
						commit
						bea6d6aeec
					
				| @ -11,6 +11,7 @@ | ||||
| * `inline-parser` -  `BangInlineProcessor` properly returns `null` if no image node is found (possible to define other inline parsers that use `!` as special character) | ||||
| * `image` - `AsyncDrawable` won't trigger loading if it has result (aim: `RecyclerView` due to multiple attach/detach events of a View) | ||||
| * `image` - `AsyncDrawable` will resume result if it is `Animatable` and was playing before detach event (aim: `RecyclerView`) ([#241]) | ||||
| * `core` - `MarkwonReducer` filter out `LinkReferenceDefinition` nodes | ||||
| 
 | ||||
| #### Fixed | ||||
| * `image-glide` cache `RequestManager` in  `GlideImagesPlugin#create(Context)` factory method ([#259]) | ||||
|  | ||||
| @ -29,7 +29,6 @@ import io.noties.markwon.recycler.table.TableEntry | ||||
| import io.noties.markwon.recycler.table.TableEntryPlugin | ||||
| import io.noties.markwon.syntax.Prism4jThemeDefault | ||||
| import io.noties.markwon.syntax.SyntaxHighlightPlugin | ||||
| import io.noties.markwon.utils.DumpNodes | ||||
| import io.noties.prism4j.Prism4j | ||||
| import io.noties.prism4j.annotations.PrismBundle | ||||
| import okhttp3.Call | ||||
| @ -128,7 +127,6 @@ class ReadMeActivity : Activity() { | ||||
|                 is Result.Success -> { | ||||
|                     val markwon = markwon | ||||
|                     val node = markwon.parse(result.markdown) | ||||
|                     Debug.i(DumpNodes.dump(node)) | ||||
|                     if (window != null) { | ||||
|                         recyclerView.post { | ||||
|                             adapter.setParsedMarkdown(markwon, node) | ||||
|  | ||||
| @ -2,6 +2,7 @@ package io.noties.markwon; | ||||
| 
 | ||||
| import androidx.annotation.NonNull; | ||||
| 
 | ||||
| import org.commonmark.node.LinkReferenceDefinition; | ||||
| import org.commonmark.node.Node; | ||||
| 
 | ||||
| import java.util.ArrayList; | ||||
| @ -48,7 +49,11 @@ public abstract class MarkwonReducer { | ||||
|                 Node temp; | ||||
| 
 | ||||
|                 while (node != null) { | ||||
|                     list.add(node); | ||||
|                     // @since $nap; do not include LinkReferenceDefinition node (would result | ||||
|                     //  in empty textView if rendered in recycler-view) | ||||
|                     if (!(node instanceof LinkReferenceDefinition)) { | ||||
|                         list.add(node); | ||||
|                     } | ||||
|                     temp = node.getNext(); | ||||
|                     node.unlink(); | ||||
|                     node = temp; | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Dimitry Ivanov
						Dimitry Ivanov