繁体   English   中英

groovy 和 gsp 中的 Markdown 超链接

[英]Markdown hyperlinks in groovy and gsp

在 mygsp.gsp 文件中,我有:

 <div><markdown:renderHtml text="${infoText}"/>/div>

在 myfile.groovy 中,我有:

 def infoText = "For further details. <http:\\\\www.myurl.com>"

输出提供了一个指向同一页面内myurl.com的超链接,在字符串“For more details”之后。

我怎样才能:

  1. 超链接“myurl.com”以在新页面中呈现?

  2. 覆盖“了解更多详情”。 代表myurl.com?

我的目标是通过 groovy 实现,HTML 会说:

  <a href="www.myurl.com". target="_/blank">For Further details</a> 

我找到了答案#2。

按照此处的markdown语法:daringfireball.net/projects/markdown/syntax#links,

我的代码应该说:

def infotext =“” [有关更多详细信息](http:\\ www.myurl.com)“”

而且有效!

我发现我的 Groovy DSL 脚本中的这一行将在示例中将“链接文本”显示为https://myurl.com的链接:

def sDescription = '''<a href="https://myurl.com">Link Text</a>'''

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM