如何在Markdown中设置HTML类属性? [英] How do I set an HTML class attribute in Markdown?

查看:96
本文介绍了如何在Markdown中设置HTML类属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我有一些Markdown,比如

  ##我的标题

这里的一段内容。

code_line(1);
//代码注释
类更多代码{}

和更多文本可以跟随...

如何在中间生成的< code> 块设置一个类?我希望将它输出

 < code class ='prettyprint'> 
code_line(1);
//代码注释
class更多代码{}
< / code>

但我似乎无法设置它。 不能 可以在Markdown中嵌入HTML 。只需输入你想要的内容,不需要缩进。

 < code class =prettyprint> 
code_line(1);
//代码注释
class更多代码{}
< / code>


If I have some Markdown like

## My Title

A paragraph of content here.

    code_line(1);
    // a code comment
    class MoreCode { }

and more text to follow...

How can I set a class on the <code> block that's generated in the middle there? I want to have it output

<code class=’prettyprint’>
  code_line(1);
  // a code comment
  class More Code { }
</code>

But I can't seem to set it. I do not have control over the Markdown code being run, only over the content.

解决方案

You can embed HTML in Markdown. Just type literally what you want, with no indent.

<code class="prettyprint">
  code_line(1);
  // a code comment
  class More Code { }
</code>

这篇关于如何在Markdown中设置HTML类属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆