-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add readme for strikethrough extension
- Loading branch information
Showing
3 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# GitHub Flavored Markdown — strikethrough extension | ||
|
||
This extension adds support for strikethrough, | ||
a [GFM extension](https://github.github.com/gfm/#strikethrough-extension-) over | ||
CommonMark. Strikethrough nodes are parsed by the `commonmark-ext-gfm-strikethrough` library, and rendered simply by | ||
wrapping their content in a `SpanStyle` that applies the `LineThrough` decoration. | ||
|
||
![Screenshot of a strikethrough](../../../art/docs/gfm-strikethrough.png) | ||
|
||
## Usage | ||
|
||
To use the strikethrough extension, you need to add the `GitHubStrikethroughProcessorExtension` to your | ||
`MarkdownProcessor`, and the | ||
`GitHubStrikethroughRendererExtension` to the `MarkdownBlockRenderer`. For example, in standalone mode: | ||
|
||
```kotlin | ||
val isDark = JewelTheme.isDark | ||
|
||
val markdownStyling = remember(isDark) { if (isDark) MarkdownStyling.dark() else MarkdownStyling.light() } | ||
|
||
val processor = remember { MarkdownProcessor(listOf(GitHubStrikethroughProcessorExtension)) } | ||
|
||
val blockRenderer = | ||
remember(markdownStyling) { | ||
if (isDark) { | ||
MarkdownBlockRenderer.dark( | ||
styling = markdownStyling, | ||
rendererExtensions = listOf(GitHubStrikethroughRendererExtension), | ||
) | ||
} else { | ||
MarkdownBlockRenderer.light( | ||
styling = markdownStyling, | ||
rendererExtensions = listOf(GitHubStrikethroughRendererExtension), | ||
) | ||
} | ||
} | ||
|
||
ProvideMarkdownStyling(markdownStyling, blockRenderer, NoOpCodeHighlighter) { | ||
// Your UI that renders Markdown goes here | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters