NerdKits - electronics education for a digital generation

You are not logged in. [log in]

Library > Syntax Examples


For security reasons we do not allow html to be used in the library. You can instead markup the text using Markdown syntax. Here are a few common examples.

Subscripts and Superscripts

Subscripts are created by enclosing the subscript in double ~ (tilde)

H~~2~~O

renders as

H2O

Superscripts are created by enclosing the superscripts in double ^ (caret)

e^^x^^

Renders as

ex


Text Formatting

**bold**

renders as bold

*italics*

renders as italics


Tables

heading1 heading2 heading 3
cell 1 cell 2 cell 3
cell 1 cell 2 cell 3
cell 1 cell 2 cell 3
cell 1 cell 2 cell 3

Syntax:

heading1 | heading2 | heading 3
---------|----------|-----------
cell 1   |  cell 2  | cell 3
cell 1   |  cell 2  | cell 3
cell 1   |  cell 2  | cell 3
cell 1   |  cell 2  | cell 3

Pre-formatted Code block

For AVR C Code:

~~~~~~~~~~~~~.c_avr
uint8_t my_func(uint16_t an_int){
    //do stuff
    while(1){
      //stay busy
    }
}
~~~~~~~~~~~~~

produces:

uint8_t my_func(uint16_t an_int){
    //do stuff
    while(1){
      //stay busy
    }
}

For Python code:

~~~~~~~~~~~~~.python
def my_func(param):
  print str(param)
~~~~~~~~~~~~~

produces:

def my_func(param):
    print str(param)

Languages currently supported are c_avr, python, c, javascript, plain, and none.

The plain class produces a preformatted code block that will still be shown with line numbers, but will not be highlighted; this is good for quoting things, or for explaining forum syntax.

A code block marked with ~ that does not specify a language, or indenting a block with 4 spaces will default to c_avr.

The none class will cause the syntax highlighter to not touch touch the code block at all and leave it as a preformatted text block.

~~~~~~~~~~~~.none
This text is not
formatted at all.
Just stays the way it is.
~~~~~~~~~~~~

Renders as:

This text is not
formatted at all.
Just stays the way it is.

Lists

For unordered lists use the * operator:

* an item
* a different item
* a third item

Will render as:

For ordered lists use a number:

1. first item
1. second item
1. third item

Will render as:

  1. first item
  2. second item
  3. third item

Links

To link to an external (not part of the library) link, make sure you use http:// at the beginning of the link.

[Title of link](http://www.linktosomewhere.domain)

To link to a wiki page the page must be preceded with the /library/ path

[Link to a wiki Page](/library/my_cool_page/)

Links to other library pages that do not exist yet are marked by a [?]. Clicking the [?] will take you to the form to create that page. To create a new page, just create a link to your new page, and then click the [?] link.


Images

To embed an image, use the following syntax to embed your image:

!Alt Text[\[?\]](/library/Direct Link/)

A few notes:

  1. The exclamation point is necessary. Otherwise, it will be interpreted as a link to the image and not an embedded image in your post.
  2. Alt Text can be anything you want. This is is the alternative text that appears if for some reason your image is not accessible. You can choose to replace this with the title of your image.
  3. Direct Link should be replaced with the URL of the image. (Note: this must be the URL of the image itself, not the URL of a webpage that holds the image.) If you already use a photo sharing service that allows you to directly link to images (Photobucket, Flickr, etc) then you can use that. If not, read on.

After a little bit of research, we are recommending imgur as the service of choice for uploading images. Imgur is free, you don't have to sign up for account with them if you don't want to, and it allows direct linking to images.

Here is how to embed an image using imgur:

  1. Go to http://www.imgur.com/ (Control+Click the link to open in a new Tab/Window)
  2. Click Computer, and select the image you want to upload.
  3. Click Start Upload
  4. imgur will then show your image and a list of different links you can use for your image. The "Direct Link" is the one you want to use. Copy it and use that URL as the Direct Link in your post.

Creating an account with imgur is not necessary, but we do recommend it. Creating an account will ensure that your image is available from them forever.

Special Note: It is also possible to have a link to the image without embedding the image in your post. To do this simply leave out the ! to make it into a normal link. In this case the text between the [ ] will be the link text. If you are linking images in this way from imgur you can copy the URL in the "Link" box instead of "Direct Link." Photobucket and Flickr will also allow you to link to their images this way.


References and footnotes

You should always give a reference to any other materials you use in your Library contributions. A reference or footnote consists of two parts, a label and a definition. Here is an example:

This is an example of a label [^1] and so is [^this] also this [^one].

And this is how you create the definitions.

[^1]: I can write stuff here
[^this]: You can link to there pages
[^one]: Another reference

Will render like this:

footnote example

You can put the definitions wherever you want in the document. They will always all render at the bottom of the page.


Notes about Markdown

Last edited by hevans on 05/10/2011 at 5:34 p.m. PDT
Did you know that you can make a capacitive proximity sensor with some aluminum foil and paperclips? Learn more...