Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Last paragraph has weird bottom margin #477

Open
wojcikrafal opened this issue May 24, 2024 · 0 comments
Open

Last paragraph has weird bottom margin #477

wojcikrafal opened this issue May 24, 2024 · 0 comments

Comments

@wojcikrafal
Copy link

  • Markwon version: 4.6.2

Using the HTML plugin when rendering mutliple paragraphs the las one has additional bottom margin. I'd expect to have all paragraphs have same margins.

class MarkwonActivity : Activity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        val markwon = Markwon.builder(this)
            .usePlugin(HtmlPlugin.create())
            .build()

        val html = """
            <p>First paragraph</p>
            <p>Second paragraph</p>
            """.trimIndent()

        setContentView(LinearLayout(this).apply {
            orientation = LinearLayout.VERTICAL
            addView(TextView(this@MarkwonActivity).apply {
                text = markwon.toMarkdown(html)
                setTextColor(Color.BLACK)
                setBackgroundColor(Color.RED)
            })
        })
    }
}

Given this sample I get the following results:

image

If I change the HTML to

val html = """
    <p>First paragraph</p>
    <b>Second paragraph</b>        
    """.trimIndent()

Then it looks like I wanted it to

image

I wouldn't mind this behavior but if add more spacing between paragraphs (via the LastLineSpacingSpan) I'll end up with doubled bottom spacing for the last paragraph.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant