Update documentation code snippets
This commit is contained in:
		
							parent
							
								
									7d76cb8eac
								
							
						
					
					
						commit
						ae01404b14
					
				| @ -5,14 +5,15 @@ | ||||
| This module adds `strikethrough` functionality to `Markwon` via `StrikethroughPlugin`: | ||||
| 
 | ||||
| ```java | ||||
| Markwon.builder(context) | ||||
| final Markwon markwon = Markwon.builder(context) | ||||
|     .usePlugin(StrikethroughPlugin.create()) | ||||
|     .build(); | ||||
| ``` | ||||
| 
 | ||||
| This plugin registers `SpanFactory` for `Strikethrough` node, so it's possible to customize Strikethrough Span that is used in rendering: | ||||
| 
 | ||||
| ```java | ||||
| Markwon.builder(context) | ||||
| final Markwon markwon = Markwon.builder(context) | ||||
|         .usePlugin(StrikethroughPlugin.create()) | ||||
|         .usePlugin(new AbstractMarkwonPlugin() { | ||||
|             @Override | ||||
| @ -26,4 +27,5 @@ Markwon.builder(context) | ||||
|                 }); | ||||
|             } | ||||
|         }) | ||||
|         .build(); | ||||
| ``` | ||||
|  | ||||
| @ -8,6 +8,7 @@ This extension adds support for GFM tables. | ||||
| final Markwon markwon = Markwon.builder(context) | ||||
|         // create default instance of TablePlugin | ||||
|         .usePlugin(TablePlugin.create(context)) | ||||
|         .build(); | ||||
| ``` | ||||
| 
 | ||||
| ```java | ||||
| @ -22,10 +23,11 @@ final TableTheme tableTheme = TableTheme.builder() | ||||
| 
 | ||||
| final Markwon markwon = Markwon.builder(context) | ||||
|         .usePlugin(TablePlugin.create(tableTheme)) | ||||
|         .build(); | ||||
| ``` | ||||
| 
 | ||||
| ```java | ||||
| Markwon.builder(context) | ||||
| final Markwon markwon = Markwon.builder(context) | ||||
|         .usePlugin(TablePlugin.create(builder -> | ||||
|                 builder | ||||
|                         .tableBorderColor(Color.RED) | ||||
| @ -34,6 +36,7 @@ Markwon.builder(context) | ||||
|                         .tableHeaderRowBackgroundColor(Color.BLACK) | ||||
|                         .tableEvenRowBackgroundColor(Color.GREEN) | ||||
|                         .tableOddRowBackgroundColor(Color.YELLOW) | ||||
|         .build(); | ||||
| )) | ||||
| ``` | ||||
| 
 | ||||
|  | ||||
| @ -5,8 +5,9 @@ | ||||
| Adds support for GFM (Github-flavored markdown) task-lists: | ||||
| 
 | ||||
| ```java | ||||
| Markwon.builder(context) | ||||
|         .usePlugin(TaskListPlugin.create(context)); | ||||
| final Markwon markwon = Markwon.builder(context) | ||||
|         .usePlugin(TaskListPlugin.create(context)) | ||||
|         .build(); | ||||
| ``` | ||||
| 
 | ||||
| --- | ||||
|  | ||||
| @ -7,6 +7,7 @@ In order to display images in your markdown `ImagesPlugin` can be used. | ||||
| ```java | ||||
| final Markwon markwon = Markwon.builder(context) | ||||
|         .usePlugin(ImagesPlugin.create()) | ||||
|         .build(); | ||||
| ``` | ||||
| 
 | ||||
| :::tip | ||||
| @ -35,6 +36,7 @@ final Markwon markwon = Markwon.builder(context) | ||||
|                 }); | ||||
|             } | ||||
|         }) | ||||
|         .build(); | ||||
| ``` | ||||
| 
 | ||||
| ```java | ||||
| @ -45,6 +47,7 @@ final Markwon markwon = Markwon.builder(context) | ||||
|                 plugin.addSchemeHandler(DataUriSchemeHandler.create()); | ||||
|             } | ||||
|         })) | ||||
|         .build(); | ||||
| ``` | ||||
| 
 | ||||
| `ImagesPlugin` comes with a set of predefined scheme-handlers: | ||||
| @ -83,6 +86,7 @@ final Markwon markwon = Markwon.builder(context) | ||||
|                 plugin.addSchemeHandler(FileSchemeHandler.createWithAssets(context)); | ||||
|             } | ||||
|         })) | ||||
|         .build(); | ||||
| ``` | ||||
| 
 | ||||
| ### DataUriSchemeHandler | ||||
| @ -156,6 +160,7 @@ final Markwon markwon = Markwon.builder(context) | ||||
|                 }); | ||||
|             } | ||||
|         })) | ||||
|         .build(); | ||||
| ``` | ||||
| 
 | ||||
| Otherwise `SchemeHandler` must return an `InputStream` with proper `content-type` information | ||||
|  | ||||
| @ -71,4 +71,5 @@ You can extend `Prism4jThemeBase` which has some helper methods | ||||
| ```java | ||||
| final Markwon markwon = Markwon.builder(context) | ||||
|         .usePlugin(SyntaxHighlightPlugin.create(prism4j, prism4jTheme)) | ||||
|         .build(); | ||||
| ``` | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Dimitry Ivanov
						Dimitry Ivanov