Markdown,在块级 html 中启用 Markdown 处理
来自 Daring Fireball 的 Markdown 文档
请注意,Markdown 格式化语法不会在块级 HTML 标记内进行处理。例如,您不能在 HTML 块内使用 Markdown 样式的强调。
我想将一些降价包装在 div 标签中,并仍然让它来处理该降价。有没有办法用开关或其他东西来做到这一点?
例如,
<div>
* * *
The asterisks would still become an <hr/>
</div>
我使用 RDiscount 作为降价过滤器。非常感谢任何帮助。
From Daring Fireball's Markdown doc
Note that Markdown formatting syntax is not processed within block-level HTML tags. E.g., you can’t use Markdown-style emphasis inside an HTML block.
I want to wrap some markdown in div tags and still get it to process that markdown. Is there a way to do this with a switch or something?
e.g
<div>
* * *
The asterisks would still become an <hr/>
</div>
I'm using RDiscount as the markdown filter. Any help is much appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Maruku 支持 HTML 块内的 Markdown。
Maruku supports Markdown inside HTML blocks.
我给 Halst 的答案打了分,因为它是正确的,但我在以这种方式使用 Maruku 时遇到了几个问题,例如它剥离了 unicode 并重新格式化了现有的 html,而我不希望它触及这些内容并导致问题。所以,我必须自己解决这个问题,这就是我想到的:
我从 Maruku 那里偷来了用“markdown='1'”属性标记 html 的想法,这样它就可以与它互换。
I gave Halst the points for the answer as it's correct, but I encountered several problems with using Maruku in this way, such as it stripping out unicode and reformatting existent html that I didn't want it to touch and caused problems. So, I had to sort it out myself and this is what I came up with:
I stole the idea of marking the html with a "markdown='1'" attribute from Maruku, so it can be interchanged with it.