noties / Markwon

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

How to make link as bold #453

Closed mohdaquib closed 10 months ago

mohdaquib commented 10 months ago
  1. Expected Behaviour- Make link as bold only in markdown text
  2. Currently after applying bold whole markdown text is becoming bold
ciouti commented 10 months ago
**[Text](Link)**
mohdaquib commented 10 months ago

Is there any way to make it using code. I have a text from BE that doesn't have this format for links

ciouti commented 10 months ago

有一个比较复杂的处理方法,先用正则表达式匹配出所有的Markdown链接标签,然后找出每个匹配项的所在位置,在匹配项的起始、结束的位置分别插入两个星号,然后才进行文本渲染。

我的建议是从后往前插入星号,这样无需重新计算要插入的位置。

我的英语不是很好,所以我用了一个翻译工具,希望你能理解我发的东西。

There is a more complex approach, the first regular expression to match all the Markdown link tags, and then find the location of each match, in the match at the beginning, the end of the position were inserted two asterisks, and then text rendering.

My suggestion is to insert the asterisk from back to front so that you don't have to recalculate the position to insert.

My English is not very good, so I used a translation tool, I hope you can understand what I sent.

mohdaquib commented 10 months ago

I got it. Thanks. I believe this is the right approach.