怎么在 Stack Overflow 里提问题的时候沾上自己的代码

0.方法零

ctrl + k  ( 0 0 对!就素辣麽简单!   )


1.方法一

 在代码前后加<pre><code></code></pre>:

         下面是我写的java源代码:

<pre><code>

package com.example;

public class Test2 {
    public static void main(String[] args) {
        System.out.println("Hello World.");
    }
}

</code></pre>


2.方法二:

To create code blocks or other preformatted text, indent by four spaces:


    This will be displayed in a monospaced font. The first four spaces
    will be stripped off, but all other whitespace will be preserved.
    
    Markdown and HTML are turned off in code blocks:
    <i>This is not italic</i>, and [this is not a link](http://example.com)
To create not a block, but an inline code span, use backticks:


The `$` character is just a shortcut for `window.jQuery`.
If you want to have a preformatted block within a list, indent by eight spaces:


1. This is normal text.
2. So is this, but now follows a code block:
 
        Skip a line and indent eight spaces.
        That's four spaces for the list
        and four to trigger the code block.




如果想要输入一段代码,或者其他的預格式化文本,缩进4个空格:


    这段文字会以一种等宽字体的格式呈现。行首的4个空格会
    被屏蔽掉,但是之后的空格就会正常显示。


    Markdown 和 HTML 在代码块里都会被屏蔽掉:
    <i>这不会被显示成斜体</i>,以及[这也不会被显示成超链接](http://example.com)
如果要创建一个内联的代码行而不是代码块的话,就使用反引号:




~$~符号就是~window.jQuery~简写形式。
如果你想要在一个清单里插入一段预格式化的段落,就缩进8个空格:


1.这是正常的文本。
2.这也是正常的文本,但是接下来它会紧接着一段代码:


        跳过一行,并缩进8个空格。
        4个空格是为了清单而输入的,而另外4个是为了表示这
        是一段代码。


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值