What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 130 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) - minor edit updated
  • 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
1  
‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮flaoting comment! ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ ‮ –  nicael Sep 26 at 13:31

308 Answers 308

Posting an answer so I can post a comment so I can test a theory.

share|improve this answer

This is a test of mixed tabs and spaces.

This line starts with four spaces.
This line starts with a tab.
    This line starts with four spaces and is indented with a tab.
    This line starts with a tab and is indented with four spaces.
    This line starts with four spaces and is indented with four spaces.
    This line starts with a tab and is indented with a tab.

aaa

share|improve this answer

This is probably not the intended use of this tag since Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.

share|improve this answer

THIS IS AN ALL-CAPITAL ANSWER TO CHECK BOT DETECTION ON THE CHAT. BUMP!

share|improve this answer
1  
The low quality posts queue detected it just fine! :-P –  Martijn Pieters Oct 18 at 16:14
#include <iostream>
#include <string>
#include <vector>

template<typename T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec)
{
    for (auto& el : vec)
    {
        os << el << ' ';
    }
    return os; // emphasized
}

"string literal"
std::string s = "std::string"
'\n'
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

Page 1 of 904625697166532776746648320380374280100293470930272690489102837043110636675

share|improve this answer

Roll the ball! Works using Markdown...

...and plain HTML

^---- Animated SVG!


Chrome's throbbers:


Formatting you possibly didn't know about:

[meta-tag:status-declined] =
[meta-tag:status-completed] =


S o r r y !

Maybe hats? Maybe Stallman smells?

share|improve this answer
27  
Dude, this is freaking epic –  Mehrdad Jul 24 '11 at 17:28
71  
Now how to find a way to fit that soccer ball into an example while helping someone with a coding problem... –  Paulpro Sep 1 '11 at 23:09
1  
Broken in Firefox 3.6. –  Mechanical snail Oct 10 '11 at 21:33
2  
@PaulPRO: Maybe on the math site? –  Mechanical snail Oct 10 '11 at 21:33
2  
@ascii-lime I'm having a hard time rotating my model of a truncated icosahedron. If only someone could provide a visual, I think I could work the code out from my existing model. Just kidding. :) –  Edwin Buck Feb 6 '13 at 21:27
5  
I'm shutting down Stack Exchange because this user told me ‮doowtA ffeJ‭ –  Doorknob Apr 30 '13 at 0:48

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
23  
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

You must log in to answer this question.

protected by Community Sep 26 at 20:45

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

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