Markdown语法通常可以方便地编写博客和评论;
但有时候当你想写一个简单的html
时它会干扰内容是否有标记/语法要求markdown忽略该部分,如pre
html标记?
如果预先工作,如果降价部分需要包含html标签怎么办?
答案 0 :(得分:13)
Markdown(由Gruber提供)和PHP Markdown的原始实现不会在块级HTML元素中进行格式化,因此您可以使用<div>
,例如:
Markdown text.
More markdown text.
<div>
Markdown ignores inside the div, you can do all sorts of crazy stuff:
<a href="http://www.stackoverflow.com">Stack Overflow</a>.
<blink>Is blink still supported?</blink>
</div>
Yet more markdown text.
将呈现为:
<p>Markdown text.</p>
<p>More markdown text.</p>
<div>
Markdown ignores inside the div, you can do all sorts of crazy stuff:
<a href="http://www.stackoverflow.com">Stack Overflow</a>.
<blink>Is blink still supported?</blink>
</div>
<p>Yet more markdown text.</p>
答案 1 :(得分:5)
至少在Stack Overflow上,... <pre>
HTML标记可以很好地用于此目的。它还像浏览器一样格式化您的文本:
This is pre-formatted, so in here I can /slash/ and *star* stuff without issues, and [[square brackets]] [are] just brackets.