linkify-it
linkify-it copied to clipboard
Better handle nested parens
As discussed in #22.
Examples:
-
http://example.com/render?target=summarize(deriviative(app.numUsers),%221min%22)&title=New_Users_Per_Minute
, from Graphite -
http://sv-t-vnl-forge-metrics:5601/?#/dashboard/Logs-Marmotte?_a=(filters:!(),panels:!((col:1,columns:!(message,host,tags),id:Marmotte-logs,row:1,size_x:12,size_y:8,sort:!('@timestamp',asc),type:search)),query:(query_string:(analyze_wildcard:!t,query:'*')),title:'Logs%20Marmotte')&_g=(refreshInterval:(display:'10%20seconds',pause:!f,section:1,value:10000),time:(from:now-15m,mode:quick,to:now))
, generated by the "share" link of Kibana 4.
Considerations:
- first implementation of #22 was rejected due ignoring rules between scoped pairs:
(foo)ignored---content(bar)
- Need to limit max nesting level (2-3 max).
Note. This issue is not critical for markdown-it. Improvment left to volunteers help.
@puzrin I believe that this issue is important for markdown-it .
In fact, not knowing that this is the underlying library - I had opened an issue there . ( sorry.. ?? )
Similar problem ( and potentially more serious because of validity of character ) also occurs with the closing parenthesis character ")"
.
Should I open another issue in this repository ?
Your case is not related to this issue anyhow. Unpaired closing scope can not be guessed as been or not been part of URL with 100% guarantee. In most of cases - it will not.
https://github.com/markdown-it/linkify-it/issues/79
More samples with nested scopes.
Hi, we are having this issue as well.
Given this URL https://example.com/teams/{{teamid}}/info
after reading your source code I figured out that in the validate
method
passed -> //example.com/teams/{{teamid}}/info
matched -> //example.com/teams/{{teamid}
and the issue might be in the regex matching at: https://github.com/markdown-it/linkify-it/blob/master/lib/re.js#L57
changing this line from
'\\{(?:(?!' + re.src_ZCc + '|[}]).)*\\}|' +
to
'\\{(?:(?!' + re.src_ZCc + '|[}]).)*\\}}|' +
fixes the issue for us but breaks matching of single curly braces.
