What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 131 Stack Exchange communities.

As per Jeff's suggestion in this comment:

You can use this question as a formatting sandbox. You can

  • edit this question itself (Community Wiki questions such as this one require 100 reputation to edit)
  • post answers to this question (Since this question is protected this requires 10 reputation)
  • post comments to this question or its answers

Beware that since the changes to syntax highlighting in December 2010, and the inline hints added March 2011, no syntax highlighting is applied unless the question's tags or an inline hint enable it. So, to test highlighting here in the sandbox:

  1. Set some language tags to this question:

    • See the explanation and the list of languages.

    • Adding clashing tags, such as both and , enforces a fallback to default, which is different from "no highlighting". (These tags are currently set on this question.)

  2. Or: on the start of a line, specify a language inline using <!-- language: lang --> hints, and indent the code 4 spaces as usual. There is a full list of hints (scroll down a little).

    <!-- language: lang-html -->
    
        While not hinted otherwise: <html></html> source <b>goes</b> "here".
    
    <!-- language: lang-js -->
    
        var a = 3;
        while (not (a > 0)) {
            alert("JavaScript code <b>goes</b> here.");
        }
    
  3. Or:

    • Save your post.

    • Use something like Firebug (Firefox), Web Inspector (Safari, Chrome) or Developer Tools (Internet Explorer 8) to edit the resulting HTML. To open Chrome Dev Tools, press F12

    • Find the <pre> element and add the attribute class="prettyprint", or change it into something more specific, like class="lang-vb prettyprint".

    • Run the following in the location bar: javascript:prettyPrint();

share|improve this question
2  
What have you tried?‮What have you tried? –  nicael Jul 4 at 16:18
1  
@nicael You're at it again... –  DatEpicCoderGuyWhoPrograms Jul 14 at 0:01

302 Answers 302

If the code block contains html entities then those are parsed and displayed instead of displaying the plain value.

The below code block contains &#0; as the input value, but instead of displaying it as it is the parsed text is displayed like �

$('body').html($('<input />', {
    id: "myInput",
    type: "text",
    value: "�"
}));
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

Source: Appending a new Input textbox DOM to HTML body using jquery

share|improve this answer

{{Infobox file format | name = | icon = | iconcaption = | icon_size = | screenshot = | screenshot_size = | caption = | extension = | mime = | type code = | uniform type = | conforms to = | magic = | developer = | released = | latest release version = | latest release date = | genre = | container for = | contained by = | extended from = | extended to = | standard = | free = | url = }}

share|improve this answer
DECLARE @origUserName varchar(max)

This is a unity3d test... C


alternative to code layout
   if 
   we can work this
out

alternative to code layout if we can work this out

alternative to code layout
if 
we can work this
out

enter image description here

share|improve this answer

✓ Unicode works in a Heading

  • ✓ Bullet works in a Heading

Multiple bullets with visible and invisible text

      • -These are bullets
      • -
  • Bullet like this too


  • 1. Blockquote your bullets

  • kbd did not break the bullets

    equal symbol below this text made it bold

    • no more blockquote bullet

Some more experiments:

  • ✓ In Bullets, it works

      • ✓ Bullet inside bullet works
      • ✓ Bullet inside bullet works (numbers are auto-adjusted)
      • ✓ Bullet inside bullet works
      • Sub bullet works
    1. Sub-bullet doesn't break the auto-numbering
    2. One more bullet

      1. Empty dash below this makes it bold

share|improve this answer
  1. let us see...
  2. oh, not 7

  1. and now?
  2. mess?
  3. all good

I have three animals:

  1. Dogs

    • Rex
      • brown
      • black
        • Dark black
        • Actually kinda grey
    • Joe
    • Pit
  2. Cats

    • Milky
    • Snowy
    • Ollie
share|improve this answer

Heh, the bash syntax highlighter is broken.

#!/bin/bash
[ $# -ge 1 -a -f "$1" ] && input="$1" || input="-"
cat $input
share|improve this answer

Experiment on behavior of hard tabs in the answer box.

Indented with "format code" button:

int main(void)
{
    do_this();
    do_that();
    if (condition)
        do_other();
    return 0;
}

Indented manually, adjusting only the lines that "belong" at the left edge:

int main(void)
{
do_this();
do_that();
if (condition)
    do_other();
return 0;
}

Both look exactly the same in the editing <textarea>, in a browser that doesn't support -moz-tab-size:4.

share|improve this answer

hello i am testing out the hi/thanks/tagline remover

share|improve this answer
2  
Quality filters, including thanks auto removal, are active only on Stack Overflow. –  Shadow Wizard Jul 17 '13 at 18:03

Links support URIs without scheme and hostname.

What is on topic here?

What is [on topic](/help/on-topic) here?

But relative URIs are not OK.

What have you tried comment

[What have you tried comment](#comment772983_3122)

share|improve this answer

Testing @@ServerName for errors

share|improve this answer

This is some text above a h1.

This is a h1

This is some text under a h1.

This is some text above a h2.

This is a h2

This is some text under a h2.

This is some text above a h3

This is a h3

This is some text under a h3.

share|improve this answer

Image sizing tests, using Stack Exchange's image host.

Original image on SE's host (http://i.stack.imgur.com/GLbK3.jpg) (1920 x 1440):
unsized

Resize, Preserving aspect ratio:

T suffix (...t.jpg) (160 x 120):
tiny

M suffix (...m.jpg) (320 x 240):
medium

L suffix (...l.jpg) (640 x 480):
large

H suffix (...h.jpg) (1024 x 768):
huge?


Resize, cropping to Square aspect ratio:

S suffix (...s.jpg) (90 x 90):
small square

B suffix (...b.jpg) (160 x 160):
big square

S parameter (...jpg?s=300) (300 x 300):
large
Valid parameters for s seem to be:
    16, 32, 64, 128, 256, 300, 500, 512, and 900.

Other values result in the maximum/default resolution.


Custom HTML:

<img src="http://i.stack.imgur.com/GLbK3l.jpg" width="400">:

share|improve this answer

Testing Can't use @ @ServerName (without the space) in answer

@@ServerName

@@ServerName

@@ServerName

You could add it as part of your query (or create a new query for it) using the @@ServerName built in function:

SELECT @@ServerName AS ServerName, *
FROM MyTable

or as a standalone query in its own dataset:

SELECT @@ServerName AS ServerName

Then you just use the following formula in your text box:

=First(Fields!ServerName.Value, "DataSet1")
share|improve this answer

Starting to rebuild the castle for modern times. Looks decent on FF so far.

full block: |        |
<kbd>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</kbd>

half block: | |
<kbd>&nbsp;</kbd>

extra block: |               |
<kbd>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</kbd>

full space: |          |
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

half space: |     |
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

extra space: |               |
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

|        |
|          |
| |
|     |

|         |
|               |
|               |


open door 1

                                                                                                              


open door 2

                                                                                                  


door top 1

                                                                                                      


door top 2

                                                                                                           


full wall 1

                                                                                                        


full wall 2

                                                                                                  


wall top

                                                                                                                               


top window 1

                                                                          


top window 2

                                                                          


full top wall 1

                                                                         


full top wall 2

                                                                         


top wall top

                                                                                             


fin

                                                                                                               
                                                                                           
                                                                                           
                                                                                            
                                                                                            
                                                                                            
                                                                                                                               
                                                                                                  
                                                                                                        
                                                                                                  
                                                                                                          
                                                                                                      
                                                                                                              
                                                                                                  
                                                                                                              
                                                                                                  
                                                                                                              

share|improve this answer
1  
<kbd>&nbsp;</kbd> How can I get it? :D –  Gediminas Jeremiah Gudelis Jun 21 '13 at 20:50

This is subbed-sup text

This is sup text

This is text

This is text

share|improve this answer
  1. List item

    Code block 
    
  2. Second list item, which unfortunately doesn't look like it's second which now looks like it's second

share|improve this answer

share|improve this answer
22  
Double bonus: you can get sick staring at that for 2 minutes. –  uɐɯsO uɐɥʇɐN Dec 8 '11 at 5:54
18  
ahhhhhhhhhhhhhh. ahhhhhhhhhhhhhhhhhhh. AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH. has a seizure –  tombull89 Dec 19 '11 at 11:02
9  
Pity this is community wiki. It's definitely worth some points. –  sarnold Dec 31 '11 at 23:19
8  
‮‮So.. reversing character? –  Lix Mar 29 '12 at 10:58
1  
What, no dancing bananas? –  Edwin Buck Feb 6 '13 at 21:30

Runnable Code Blocks Using a User Script

var canvas = document.createElement( "canvas" ),
    ctx = canvas.getContext( "2d" );
canvas.width = 640;
canvas.height = 320;
canvas.style.margin = "0 auto";
canvas.style.background = "rgb( 0, 0, 32 )";
ctx.lineWidth = 5;
out.appendChild( canvas );

for ( var i = 0; i < 1024; ++i ) {
  ctx.strokeStyle = "rgba( 200, " + ((128 + Math.random() * 127)|0) + ", 0, " + 0.1 * Math.random() + " )";
  ctx.beginPath();
  ctx.arc( 320 - 40 * Math.random(), 160 - 20 * Math.random(), Math.random() * 256,
           Math.random() * Math.PI * 1.5, Math.random() * Math.PI * 0.5, true );
  ctx.stroke();
}

  [ run with user script ]  

$( out ).append( $( "<p>Hello World</p>" ) );

  [ run with user script ]  

var message = "Hello World",
    messageEl = document.createElement( "p" );

messageEl.textContent = message;
out.appendChild( messageEl );

  [ run with user script ]  

Want to be able to run your code like that? Just add this line following a code block:

 <img src="http://i.stack.imgur.com/V6KuG.gif" width="480" height="1" /><sup><sup><sup><sup><sup>**[`  [ run with user script ]  `](http://scripts.jeremybanks.ca/run-stackexchange-code-0.0.user.js)**</sup></sup></sup></sup></sup>

Your code's wrapped in a function under the global context, only given the out element as an argument.

Prevent Scroll Bars From Being Hidden on Code Blocks on Mac OS X 10.7 "Lion"

Here's a code block that's probably scrollable in both directions. If you're using a trackpad with Mac OS X 10.7 "Lion", you can install this user script that uses this code to prevent scroll bars from being hidden on code blocks.

atest( "TO FAIL | return false", function () { return false; } );
atest( "TO FAIL | do nothing", function () { } );
atest( "TO FAIL | error", function () { throw new Error; } );

atest( "TO FAIL | don't let more than 2 seconds pass", function ( assert, pass, toCleanUp ) {
  var start = new Date;

  return function poll () {
    assert( ((new Date) - start) < 2000, "two seconds must not pass" );
    return poll;
  }
} );

atest( "return true", function () { return true; } );

atest( "Count to 10 Over 1 Second", function ( assert, pass, toCleanUp ) {
  var val = 0,
      incInterval = setInterval( incVal, 100 );

  function incVal () {
    val += 1;
  }

  toCleanUp(function () {
    clearInterval( incInterval );
  })

  return function poll () {
    return ( val > 10 ) ? true : poll;
  };
});

atest( "Load /", function ( assert, pass, toCleanUp ) {
  jQuery.ajax( "/" ).done(function ( data ) {
    pass( "Loaded " + data.length + " chars." );
  });
});

atest( "Adding even integers doesn't produce an odd one", function ( assert, pass, toCleanUp ) {
  for (var n = -10000; n < 10000; n += 2) {
    assert( n % 2 === 0, "" + n + " is not a multiple of two." )
  }
  pass();
});

/*\
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  
  atest( name, body( assert, pass, toCleanUp ) );                    *
    Declares an test with the specifed name and body. It will be     *
    run synconously with other tests defined syncronously with it.   *
                                                                     *
  runaTest( body( assert, pass, toCleanUp ) );                   *
    Executes a test body and returns a promise of the result.        *
                                                                     *
  A test body can return true to pass, false to fail or a function   *
  to continue to it asyncronously. This happens with a delay, so it  *
  can be used to poll some state.                                    *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
\*/

runaTest.timeout = 5000;
runaTest.tickDelay = 100;
atest.cooldown = 250;

function atest ( name, body ) {
  if ( !atest.buffer ) {
    atest.buffer = [];
    setTimeout( triggerTests, 0 );
  }

  atest.buffer.push( [ name, body ] );

  function triggerTests () {
    var buffer = atest.buffer,
        i = 0;

    delete atest.buffer;
    triggerNext();

    function triggerNext () {
      if ( i < buffer.length ) {
        var name = buffer[ i ][ 0 ],
            body = buffer[ i ][ 1 ],
            testRun = runaTest( body );

        testRun.then(function passed () {
          $("<p/>").text( [ "pass [" + name + "]" ].concat( [].slice.call( arguments ) ).join(" - ") ).appendTo(out);
        }, function failed () {
          $("<p/>").text( [ "FAIL [" + name + "]" ].concat( [].slice.call( arguments ) ).join(" - ") ).css("color", "red").appendTo(out);
        });

        testRun.always(function () {
          setTimeout( triggerNext, atest.cooldown );
        });

        ++i;
      }
    }
  }
}

function runaTest ( body ) {
  var result = new jQuery.Deferred,
      tickInterval = setInterval( tick, runaTest.tickDelay ),
      timeoutTimeout = setTimeout( result.reject, runaTest.timeout, "Timeout" ),
      active = body;

  return result.promise();

  function assert ( condition, msg ) {
    if ( !condition ) {
      var failArgs = [ "Assertion failed" ].concat( [].slice.call( arguments, 1 ) );
      result.reject.apply( result, failArgs ) ;
    }
  }

  function tick () {
    if ( result.state() === "pending" ) {
      if ( typeof active === "function" ) {
        try {
          active = active.call( result, assert, result.resolve, result.always );
        } catch ( ex ) {
          result.reject( "Uncaught exception", ex );
          $("<p/>").text(ex.stack).appendTo(out);
        }
      } else if ( active === true ) {
        result.resolve();
      } else if ( active === false ) {
        result.reject();
      }
    } else {
      clearInterval( tickInterval );
    }
  }
}

  [ run with user script ]  

Tag Markup Castle

                                                                             
                                                                             
                                                                             
                                                                             
                                                                             
                                                                                               
                                                                                                                                           
                                                                                                                                                                                              
                                                      
                                         
                                                        
                                                       
                                                        
                                                       

share|improve this answer
1  
Freaking awesome! –  Mistu4u Jan 4 '13 at 8:42
3  
This is terribly borked now. –  The Guy with The Hat Apr 17 at 14:01

Testing Japanese spacing.

〇一二三四五六七八九十 <--- 1-10

 一 三 五 七 九  <--- by 2s, japanese space

一 三 五 七 九  <--- by 2s, western space

ひらがなカタカナ漢字単語

 らがな タカナ 字単語

share|improve this answer

‮this is kind of reversed text. It is pretty simple of course. You already can click edit

Reversing works

link

hash works

share|improve this answer

List of canonical questions from the main site (for closing questions as dupes). These are mostly the ones I use (and putting them in my Formatting Sandbox post just makes it easier to go back to)

Java:

C:

One thing that I want to add later: something related to "what every programmer should know about floating point" to both languages.

share|improve this answer

Duplicating Python3's print() function is easy. Make a function that takes an argument, named whatever you want, then print that argument when the function is invoked from the interpreter. Easy.

def println(stringint):
    print stringint

Here's how you'd invoke it in your interpreter with the argument.

>>> import <filename>
>>> <filename>.println("Hello, this is a test.")
Hello, this is a test.
>>> <filename>.println(12 / 2 + 6)
12

You can also invoke it like this, without having to add the filename.

>>> from <filename> import println
>>> println("Hello, this is a test.")
Hello, this is a test.
>>> println(12 / 2 + 6)
12

There you have it, a duplicate of Python3's print() function. Yay.

share|improve this answer

Testing code formatting assssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
asfasfas
gdagf
Testing code formatting assssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
asfasfas
gdagf
share|improve this answer

Header 1

Header 2

Bold Italics

public void StackOverflow() { StackOverflow(); }

The StackOverflow() function calls itself, causing a StackOverflowException or StackOverflowError (.NET and Java respectively).

Breaking the workflow:

There are probably children out there holding down spacebar to stay warm in the winter! YOUR UPDATE MURDERS CHILDREN.

There are probably children out there holding down spacebar to stay warm in the winter! YOUR UPDATE MURDERS CHILDREN.

That

Block

Quote

THE Tags:

share|improve this answer

This is a blockquote. I think.

This is a double blockquote.

This is a triple blockquote.

And this is a quadruple blockquote.

Here's some bold text.

Here's some italic text.

Here's some bold italic text

Here's a link

print("Here's some code.")

Here's
some
newlines.

Here's an image.

Here's a .

Here's some in-text code.

Here's some emojis: 🌚😊🌲🌳🕖💦🌊😷🎳😞👾🏉.

Here's Arabic numbers? ١٢٣٤٥٦٧٨٩٠

You can hit a key to perform an action.

Here's a meta tag.

I love to <code> a lot in on my .

Here's an unordered list.

  • Cheese is good.
    • Don't try the smelly kinds though.
  • Doge is love. Doge is life.
    • Once you accept this fact, life is glorious.

This is a strike through

share|improve this answer
1  
@nicael leacin is posting some weird things. Oh well. –  DatEpicCoderGuyWhoPrograms Jul 4 at 20:42
1  
if(life.lifestatus == lifefeelings.awesome && life.problems == Null) {System.out.println("YAY!")} –  DatEpicCoderGuyWhoPrograms Jul 5 at 21:39
1  
Love it :-). However it should be if(life.status==kLifeStatusTypeAwesome && lifefeelings==kLifeFeelingsTypeAwesome && life.problems == Null){System.out.println("YAY!")} –  nicael Jul 5 at 21:42

“This question has more than 30 answers.” You don’t say.

class Line
{
    virtual int num() = 0;
};
share|improve this answer

Is VB comment syntax highlighting working?

Sub AMethod()
    'a comment
    Dim SomeCode
End Sub
'A comment
Sub AMethod()
   Dim SomeCode
End Sub

Boo that meta hides the colors :(

share|improve this answer

foo foo\foo\ foo foo

filler text

share|improve this answer

having trouble getting rid of the sliver between the images (wrapping them in a <h1></h1> helps.)

share|improve this answer
31  
‮Please do not speak of being messed up until you read this! –  uɐɯsO uɐɥʇɐN Jan 11 '11 at 22:40
4  
@Nyu: O the wonders of Unicode! –  uɐɯsO uɐɥʇɐN Jan 30 '11 at 20:10
11  
No seriously - how do you flip even the time block? –  RichardTheKiwi Mar 3 '11 at 1:46
2  
(^_^) [ ](meta.stackoverflow.com) –  Awesome Poodles Mar 9 '11 at 13:56
3  
@JefMercado: Please? –  Ullallulloo May 4 '11 at 19:50
1  
‮...yletanutrofnu ,gnitaehc yb ylno tub ,ti tog I –  minitech May 25 '11 at 2:21
4  
I can turn the world inside out! I'll start with the comment stamp...‮ –  Daniel Sep 29 '11 at 17:17
1  
‮At last! At long last! The secret is mine! –  John Oct 11 '11 at 1:15
7  
Ha! I am over here :-P ‮this is a test –  amanaP lanaC A nalP A naM A Dec 7 '11 at 16:48
1  
I Roamed Under It As A Tired Nude Maori ‮‮ i roaMed uNder iT As A tIred nUde maoRI –  Manishearth Mar 27 '12 at 12:42
1  
Yay, I figured it out!! Copy the character inside the codeblock to get it it's a mirroring character. Note that the codeblock may have placed itself after my username. "‮‮ " –  Manishearth Mar 27 '12 at 12:43
18  
Hello, I am Jon Skeet. ‮‮ teekS noJ - –  Manishearth Mar 30 '12 at 11:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .