Formatting Posts
Codidact uses the CommonMark implementation of Markdown for formatting posts.
Italics
You can italicize a word by placing a single asterisk (*
) or single underscore (_
) around a word. Either *Codidact*
or _Codidact_
will render as Codidact.
Bold
You can bold a word by placing a double asterisk or double underscore around that word. Either **Codidact**
or __Codidact__
will render as Codidact.
Monospace / code formatting
To make a word monospace, you can surround it with a single backtick (`
). This is generally used for code formatting. (Some people use this for emphasis. Don't do that! Screen readers will read out words formatted as code character by character - use italics or bold for emphasis instead.)
To mark several lines as code, you can use a code fence. This is three backticks on a newline both on top and at the bottom of your lines of code. Don't use this for quotes - see below for guidance on quote formatting.
Links
You can generate a link using one of two methods. One way is to encase your link text in square brackets ([ ]
) and then the target URL in parentheses (( )
). [Codidact](https://codidact.org)
will render as Codidact.
You can also format a link with the inline text being [Codidact][1]
, and then at the bottom of the post include the URL with the format [1]: https://codidact.org
. This will look something like this:
You can check out [Codidact][1] for an open-source, community-oriented Q&A platform!
Which will render like this:
You can check out [Codidact][1] for an open-source, community-oriented Q&A platform!
[1]: https://codidact.org
If you'd like to include rollover text for your link, you can put your text, surrounded by quote marks ("
), into the URL of your link. For instance, [Codidact](https://codidact.org "The open-source Q&A platform")
will create a link with The open-source Q&A platform
as the rollover text.
Blockquotes
When quoting text from somewhere else, you can use a blockquote to signify that this is not your original text, but a quote from somewhere else. Put a greater than symbol (>
), followed by a space, before a paragraph to mark that quote as a blockquote. For instance, > This is a blockquote!
will render as a quote:
This is a blockquote!
If you want to include a second paragraph as part of the same quote, you have to include another >
before each line, like this:
> This is a blockquote!
>
> This is part of the same quote!
This will render as a single blockquote:
This is a blockquote!
This is part of the same quote!
See also the citation and referencing help for guidelines on how to properly reference different quotes from various places.
Images
Embedding images in a post is very similar to the formatting for links (detailed above). The format ![alt text](image URL)
will embed an image in your post. Please remember to write alt text for your image! Codidact allows you to upload an image directly, or you can embed an external image from image hosting sites such as Imgur.
Lists
You can generate either an ordered list or a bullet list. For a bullet list, you can use either *
or -
to create your list.
* List item one
* List item two
This will render like this:
- List item one
- List item two
If you want to create a numbered list, use 1.
, 2.
, etc instead of *
or -
. Note that the exact number you use, in most cases, is irrelevant - after the first number that you use, no matter what number you put in, Codidact will automatically number it in order. For instance, if you create a list and type 1. List item #1
for the first line, then 3. List item #2
for the second line, Codidact will automatically render the 3.
as a 2.
. If you begin your list at any other number, such as your first list item is numbered 5.
, Codidact will continue from that number onwards (with the next number automatically rendering as 6.
).
Horizontal line
You can use a horizontal line for separating sections of your post. Use ---
on its own line to generate a horizontal line.
Headings
You can include a heading in your post. Using a single hash symbol (#
) before a line of your post will create a large heading, while adding another will create a slightly smaller heading (up to six different heading sizes).
# Heading 1
Heading 2
Heading 6
Heading 1
Heading 2
Heading 6
Footnotes
To include a footnote in your post, you can use the syntax [^1]
. In your main text, include Text[^1] and more text
, and at the bottom (where you want to include your footnote), place a line resembling [^1]: footnote text
.
How do I write equations and mathematical symbols?
Code Golf supports the typesetting language LaTeX by way of the MathJax library. Users can add equations in a post by enclosing them with single or double dollar signs, for inline and block equations, respectively. For example, $E=mc^2$
renders as $E=mc^2$, while $$E=mc^2$$
renders as
$$E=mc^2$$
- Greek letters can be written by adding a backslash in front;
\alpha
renders as $\alpha$ and\Gamma
renders as $\Gamma$. - Fractions are written as
\frac{numerator}{denominator}
. - Roots and exponents use the syntax
\sqrt[n]{number}
andnumber^{n}
, respectively:\sqrt[3]{2}
becomes $\sqrt[3]{2}$ and3^2
becomes $3^2$. - Sums and integrals are denoted by
\sum
and\int
. Use underscores and carets to denote the bounds:\sum_{n=1}^{\infty}\frac{1}{n^s}
and\int_{0}^{\infty}x^{s-1}e^{-x}dx
become $$\sum_{n=1}^{\infty}\frac{1}{n^s}$$ and $$\int_{0}^{\infty}x^{s-1}e^{-x}dx.$$ - To apply an operation (such as exponentiation) to multiple characters, enclose them in braces $\{\}$:
e^{-kt}
becomes $e^{-kt}$, whilee^-kt
would render as $e^-kt$. - Parentheses, brackets and braces (
()
,[]
,{}
) may be used to group expressions, though braces require forward slashes before them; otherwise, they're interpreted as grouping LaTeX characters. Additionally,\left
and\right
may be used together to automatically modify the size of these symbols. For example,a=b\{c+d\}
produces $a=b\{c+d\}$ and1+\left(\frac{n(n+1)}{2}\right)
produces $$1+\left(\frac{n(n+1)}{2}\right)$$ Note that each instance of\left
requires a corresponding instance of\right
. - For spaces, use
\,
,\;
,\quad
and\qquad
, in order of increasing size:a\,b\;c\quad d\qquad e
gives $a\,b\;c\quad d\qquad e$ and to insert regular text into equations, you can use\text{...}
For more information, check out the American Mathematical Society's official user guide for Version 2.1 of LaTeX.
For a comprehensive list of $LaTeX$ notation, see The Comprehensive $\LaTeX$ Symbol List