asjqkkkk / markdown_widget

📖Rendering markdown by flutter!Welcome for pr and issue.
MIT License
321 stars 93 forks source link

Hello, is there a way to add url higlight? #129

Open OpenJarvisAI opened 1 year ago

OpenJarvisAI commented 1 year ago

I mean pure url, not markdown xx url

asjqkkkk commented 1 year ago

Hi @OpenJarvisAI , can you provide a sample to descripbe the url? such as

https://github.com/asjqkkkk/markdown_widget

// or

[url description](https://github.com/asjqkkkk/markdown_widget)
OpenJarvisAI commented 1 year ago

Just www.baidu.com

this text can not be higlighted even set url config,

but http://www.baodu.com seems can

asjqkkkk commented 1 year ago

image

Hi @OpenJarvisAI , base on the current sample, the two urls are performing the same.

OpenJarvisAI commented 1 year ago

@asjqkkkk that's weired, seems not work on my side.

image

this is weired.

am I ddi something wrong?

image

the behavior is very strange

asjqkkkk commented 1 year ago

Hi @OpenJarvisAI, could you please provider a minimal sample code with the sample data I think the parsing problem may be caused by incorrect usage or data source issues.

OpenJarvisAI commented 1 year ago

好的,这是几个网址:

  1. 百度:www.baidu.com
  2. 腾讯:www.tencent.com
  3. 阿里巴巴:www.alibaba.com
image

can not parse , and above is raw data source

asjqkkkk commented 1 year ago

I know the reason, you need add space between the url and other symbol

such as this: 百度: www.baidu.com 腾讯: www.tencent.com 阿里巴巴: www.alibaba.com

no space it'll not working:

百度:www.baidu.com 腾讯:www.tencent.com 阿里巴巴:www.alibaba.com

OpenJarvisAI commented 1 year ago

@asjqkkkk Don't know it is standared or a bug, but if ww.baidu.com的回复恶搞。continues without a space, the whole text will detected as url. It can hard code handled in this situation?

asjqkkkk commented 1 year ago

I think it's the markdown standard, you can have a look with: https://spec.commonmark.org/0.30/#links

OpenJarvisAI commented 1 year ago

is there any way to make it process common usage which might url linke with normal text?

asjqkkkk commented 1 year ago

Yes, but you need to write a InlineSyntax, such as AutolinkExtensionSyntax

OpenJarvisAI commented 1 year ago

@asjqkkkk any example to do it?

asjqkkkk commented 1 year ago

@OpenJarvisAI

https://github.com/dart-lang/markdown/blob/master/lib/src/inline_syntaxes/autolink_extension_syntax.dart

you can also submit an issue to markdown

If this package can identify the content above as a link, this issue will be resolved.