noties / Markwon

Android markdown library (no WebView)
https://noties.io/Markwon/
Apache License 2.0
2.68k stars 298 forks source link

Q: Unable to parse both markdown and HTML within the same string #416

Closed enamuls closed 1 year ago

enamuls commented 1 year ago
  1. I want to parse a mixture of markdown and HTML within the same string. For example my sample string is

"<div>You are only eligible for a booster dose of COVID-19 vaccine if you meet the following requirements:</div> <ul><li> You are **over 16 years of age**.</li> <li>You have **completed 2 doses of your Covid-19 vaccination**.</li><li>It has been **more than 3 calendar months since your second dose and not one day before**.</li></ul><div>&nbsp;**For example** second COVID-19 vaccine completed on the 15th of July, eligible to receive your booster from (and not before) the 15th of October.&nbsp;</div><div> If you attend your appointment earlier, you will be turned away until you are eligible.</div><p>For more information on eligibility, please refer to the [Department of Health website](https://www.health.gov.au/sites/default/files/documents/2021/10/atagi-recommendations-on-the-use-of-a-booster-dose-of-covid-19-vaccine.pdf)</p>"

  1. I have used below to parse the string but it only seem to parse HTML but not markdown at all

Markwon.builder(context).usePlugin(HtmlPlugin.create()).build()

  1. The output I get is like below on a textView

Screenshot_20221019_103221

noties commented 1 year ago

Hello @sam911 ,

you cannot mix html and markdown in such a way. Take a look at the reference implementation.

Your whole input is parsed as html. Given your use-case it seems it is better to pick one - either HTML or markdown and use it exclusively