Skip to main content
3 of 6
added 1007 characters in body
Mathieu Guindon
  • 75.6k
  • 4
  • 99
  • 243

###Hello, World!

Markdown

Use begin snippet and end snippet HTML comments to denote the beginning and ending of a snipped, and specify the language with the usual language comment:

<!-- begin snippet: js hide: false -- >

<!-- language: lang-js -- >

    alert("hello, world!");

<!-- end snippet -- >

...or just click click the "Code snippet" button on the edit toolbar, right next to the "Image" button. Shortcut: Ctrl+M.


Render

The snippet block will render as an everyday code block, with a Run code snippet button:

alert("hello, world!");


###Output

These executable snippets can be embedded anywhere in your question/answer:

alert("so each snippet gets its own 'Run code snippet' button.");
document.write("...and its own little output box.");

When editing a post with an embedded , an [Edit the above snippet] link brings the snippet editor, which also lets you enter and :

.foo {
 background: yellow
}
<div class="foo">
  foo
</div>

Mathieu Guindon
  • 75.6k
  • 4
  • 99
  • 243