Markdown Astrohacker Markdown

Astrohacker Flavored Markdown, also called "Astrohacker Markdown", is the standard format for documents on Astrohacker. It is the same as GitHub Flavored Markdown, plus TeX mathematics, plus special features. This article provides an overview of Astrohacker Markdown.

Markdown

Markdown was created by John Gruber in 2004 for plaintext documents that look good in a text editor and that render well for the web. It has become the most popular way to write documents for the web that need to be versioned or where other details need to be controlled explicitly and where WYSIWYG editors do not apply, such as documentation or blog posts.

GitHub Flavored Markdown

There are multiple conflicting standards for markdown. One of the most common and useful flavors of markdown is GitHub Flavored Markdown. Please see the specification hosted at GitHub for details about GitHub Flavored Markdown. Astrohacker Flavored Markdown implements all GitHub Flavored Markdown features and more.

Viewing Source Code

This document provides an overview of Astrohacker Markdown, but sometimes the easiest way to learn code is to see the actual code. You can always press the "view source" button in the top right of every Astrohacker paper to view the source code. You can view the code of this very paper if you would like to see how any of the examples work.

Markdown Overview

You can create headers by using the # symbol followed by a space. The number of # symbols determines the level of the header.

Headers

# Header 1
## Header 2
### Header 3

Emphasis

You can make text bold or italic using Markdown:

  • Bold: Wrap the text with two asterisks **bold**
  • Italic: Wrap the text with one asterisk *italic*

Creating hyperlinks in Markdown is simple. You can link text like this:

[Visit Astrohacker](https://www.astrohacker.com)

Images

To embed images, use the following syntax:

![Image Alt Text](https://www.example.com/image.jpg)

Learn more about images below.

Lists

You can create both ordered and unordered lists in Markdown:

Unordered List

- Item 1
- Item 2
- Item 3

Ordered List

1. First Item
2. Second Item
3. Third Item

TeX Mathematics

On Astrohacker, you can also use TeX-style formatting for mathematical equations. Simply wrap your mathematical expressions with `$$` to display them:

$$
E = mc^2
$$

Learn more about TeX mathematics below.

Images

Images can be inserted into the editor on any desktop computer by dragging an image into the editor where you want the image to go. Preview images will be generated automatically and displayed in the draft. The original image can be downloaded by pressing the download button next to the preview.

Astrohacker only supports images that were uploaded directly to Astrohacker. It is not possible to render images from other places on the web.

Images can be either block-level or inline-level. Block images fill the width of the document and have a maximum height. Inline images are presented in a thumbnail format.

Inline images can be inserted in titles and are used as the file icon presented in summaries.

Dark Mode Images

Images support dark mode. Every image URL can contain a darkmode parameter which can be changed to a different image. This enables producing white charts for the day and black charts for night, so that your charts don't blind astronomers who have to read papers at night.

Sun / Moon

An image of the sun or the moon depending on what time of day you view it. Try toggling your system settings from dark mode to light mode to see a different image.

The code for this image is:

![An image of the sun or the moon depending on what time of day you view it. Try toggling your system settings from dark mode to light mode to see a different image.](images/3e7b523bfca365dfe4b28b0e.jpg?darkmode=images/3703520ac550c1759b8fa5d2.jpg&type=png Sun / Moon)

The same image inline looks like this: An image of the sun or the moon depending on what time of day you view it. Try toggling your system settings from dark mode to light mode to see a different image.

TeX Mathematics

TeX was invented by Donald Knuth in 1978 as markup language for books with support for mathematics. TeX is designed to render output exactly the same every time, which is appropriate for books, but is not appropriate for the web, where different devices need to render the same content with different dimensions. However, TeX for mathematics can be embedded inside web documents, and this has emerged as the standard way to write math on the web.

Astrohacker uses KaTeX to render math inside markdown documents. Please see the KaTeX documentation for a precise description of the flavor of TeX we support.

Dollar symbols ($) are the most common way to denote TeX in markdown. We support two ways to insert TeX into a markdown document: inline math wrapped with one dollar sign, $, and block math wrapped with two dollar signs, $$.

Inline math is TeX wrapped with a single $ symbol in a line, such as $\psi(x), which shows up as ψ(x)\psi(x).

Block math is TeX wrapped with double $$ symbols intended to be displayed as a separate paragraph, like,

$$
\psi(x)=e^{-iHt}\psi(0).
$$

This code renders as,

ψ(x)=eiHtψ(0). \psi(x)=e^{-iHt}\psi(0).

Special Features

Special features are coming soon and will be documented here.

Permissions

Only premium users can publish links and images in papers. Preview users can only use links and images in drafts.