Skip to content

Commit

Permalink
Merge pull request #131 from hugolden/link_underlined
Browse files Browse the repository at this point in the history
Fix for Issue 126, provide option to disable underline for link
  • Loading branch information
jeziellago authored Nov 1, 2024
2 parents 7e5ed50 + aa40faf commit 320d99a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ internal object MarkdownRender {
syntaxHighlightColor: Color,
syntaxHighlightTextColor: Color,
headingBreakColor: Color,
enableUnderlineForLink: Boolean,
beforeSetMarkdown: ((TextView, Spanned) -> Unit)? = null,
afterSetMarkdown: ((TextView) -> Unit)? = null,
onLinkClicked: ((String) -> Unit)? = null,
Expand All @@ -41,6 +42,7 @@ internal object MarkdownRender {
MardownCorePlugin(
syntaxHighlightColor.toArgb(),
syntaxHighlightTextColor.toArgb(),
enableUnderlineForLink,
)
)
.usePlugin(HtmlPlugin.create())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ fun MarkdownText(
syntaxHighlightColor: Color = Color.LightGray,
syntaxHighlightTextColor: Color = Color.Unspecified,
headingBreakColor: Color = Color.Transparent,
enableUnderlineForLink: Boolean = true,
beforeSetMarkdown: ((TextView, Spanned) -> Unit)? = null,
afterSetMarkdown: ((TextView) -> Unit)? = null,
onLinkClicked: ((String) -> Unit)? = null,
Expand All @@ -63,6 +64,7 @@ fun MarkdownText(
syntaxHighlightColor,
syntaxHighlightTextColor,
headingBreakColor,
enableUnderlineForLink,
beforeSetMarkdown,
afterSetMarkdown,
onLinkClicked,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import org.commonmark.node.ThematicBreak
class MardownCorePlugin(
private val syntaxHighlightColor: Int,
private val syntaxHighlightTextColor: Int,
private val enableUnderlineForLink: Boolean,
private val onTextAddedListeners: MutableList<OnTextAddedListener> = ArrayList(0)
) : CorePlugin() {

Expand All @@ -68,6 +69,7 @@ class MardownCorePlugin(

override fun configureTheme(builder: MarkwonTheme.Builder) {
builder.codeBackgroundColor(syntaxHighlightColor)
builder.isLinkUnderlined(enableUnderlineForLink)
if (syntaxHighlightTextColor != Color.Unspecified.toArgb()) {
builder.codeTextColor(syntaxHighlightTextColor)
}
Expand Down

0 comments on commit 320d99a

Please sign in to comment.