Markwon
Markwon copied to clipboard
How to remove underline while using h1 tag in redme ?
i am using h1 tag in readme section and at the end of the title an underline is appear, how should i get rid of that underline?
same issue, how to remove underline for H1 and H2 ?
Tried this?
private class NoSpecialTreatmentOfH1H2Plugin : AbstractMarkwonPlugin() {
override fun configureSpansFactory(builder: MarkwonSpansFactory.Builder) {
builder.setFactory(Heading::class.java) { configuration, props ->
HeadingSpanModified(
configuration.theme(),
CoreProps.HEADING_LEVEL.require(props)
)
}
}
}
private class HeadingSpanModified(theme: MarkwonTheme, range: Int) : HeadingSpan(theme, range) {
override fun drawLeadingMargin(
c: Canvas?,
p: Paint?,
x: Int,
dir: Int,
top: Int,
baseline: Int,
bottom: Int,
text: CharSequence?,
start: Int,
end: Int,
first: Boolean,
layout: Layout?
) {
// NO-OP
}
}
And creating Markwon
by:
val markwon = Markwon.builder(context).usePlugin(NoSpecialTreatmentOfH1H2Plugin()).build()
Hello @Groot-2001, @tatavarthitarun , @c-b-h ,
there is a heading theme attribute you can use:
val markwon = Markwon.builder(context)
.usePlugin(object: AbstractMarkwonPlugin() {
override fun configureTheme(builder: MarkwonTheme.Builder) {
builder.headingBreakHeight(0)
}
})
.build()