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