New

ShareBin Guide: Mastering Your Markdown Pastes

Welcome to the ShareBin guide! ShareBin is a powerful and flexible Markdown pastebin, designed for simplicity and efficiency. Heavily inspired by rentry.co,

ShareBin distinguishes itself as a free and open-source solution that is easily self-hostable.

Leveraging modern Markdown processing with GitHub Flavored Markdown (GFM) support, ShareBin supports a comprehensive set of Markdown features including tables, task lists, math equations, and syntax highlighting, allowing you to format your text with ease and precision.

This guide provides an in-depth overview of Markdown syntax supported by ShareBin, adapted with modifications from learnxinyminutes. Whether you're a seasoned Markdown user or just starting, this guide will help you create well-structured and visually appealing pastes.

🔗 Custom URLs

When creating a new paste, you have the option to specify a custom URL for easy access and sharing.

🛡️ Edit Codes

To control access and modifications to your paste, you can set a custom edit code.

🔒 Client-Side Encryption

ShareBin now supports client-side encryption for sensitive content. Your data is encrypted in your browser before being sent to the server, ensuring maximum privacy.

How It Works

Using Encryption

  1. When creating a paste, check the "🔒 Encrypt this paste with a password" option
  2. Enter a strong password (minimum 8 characters)
  3. Optionally use the 🎲 button to generate a secure password
  4. Save your paste - it will be encrypted before submission
  5. Share the paste URL and password separately for maximum security

Decrypting Pastes

When viewing an encrypted paste:

  1. A decryption prompt will appear automatically
  2. Enter the correct password
  3. The content will be decrypted in your browser
  4. Edit the decrypted content normally

✨ Enhanced Editor Features

The editor now includes powerful features to enhance your writing experience:

Keyboard Shortcuts

Toolbar

Use the visual toolbar above the editor for quick formatting:

Live Preview

🌐 HTML Elements

Markdown is designed to be easily readable and writable, but it also allows for the seamless integration of raw HTML. This means any valid HTML can be embedded directly into your Markdown document.

<!--
  You can use standard HTML elements within your Markdown.
  However, be aware that Markdown syntax will not be processed
  inside raw HTML blocks. For example, `*bold*` will not render as bold
  if it's inside a `<div>` tag.
-->
<div>
  This is a <em>mix</em> of HTML and Markdown.
  Markdown **will not** be processed here.
</div>

Important Considerations:

📝 Headings

Headings are crucial for structuring your content and improving readability. Markdown supports six levels of headings, from <h1> (the most important) to <h6> (the least important).

Hash-style Headings

Use one to six hash symbols (#) at the beginning of a line, corresponding to the heading level. The number of hashes determines the heading level.

# This is an H1 heading
## This is an H2 heading
### This is an H3 heading
#### This is an H4 heading
##### This is an H5 heading
###### This is an H6 heading

Setext-style Headings

For <h1> and <h2> only, you can use an underline of equals signs (=) for <h1> or hyphens (-) for <h2> on the line immediately following the heading text. The number of characters in the underline doesn't matter, as long as there's at least one.

This is an H1 heading
=====================

This is an H2 heading
---------------------

Best Practices for Headings:

✨ Simple Text Styles

Markdown provides straightforward ways to apply common text styles like italics, bold, and strikethrough.

Italics

To render text in italics, enclose it with either single asterisks (*) or single underscores (_).

*This text is in italics.*
_And so is this text._

Bold

To make text bold, use double asterisks (**) or double underscores (__).

**This text is in bold.**
__And so is this text.__

Bold and Italics

Combine three asterisks (***) or three underscores (___) to apply both bold and italics.

***This text is in both.***
**_As is this!_**
*__And this!__*

Strikethrough

To apply strikethrough to text, enclose it with two tildes (~~).

~~This text is rendered with strikethrough.~~

Best Practices for Text Styles:

📄 Paragraphs

Paragraphs are fundamental blocks of text in Markdown. A paragraph is simply one or more consecutive lines of text, separated by one or more blank lines.

This is the first paragraph. It can span multiple lines,
and as long as there's no blank line in between, it's considered part of the same paragraph.

This is the second paragraph. A single blank line separates it from the previous one.


This is the third paragraph. Multiple blank lines have the same effect as a single blank line in separating paragraphs.

Best Practices for Paragraphs:

💬 Blockquotes

Blockquotes are used to highlight quoted text, often from an external source or for emphasis. They are indicated by a > character at the beginning of each line of the quoted text.

> This is a blockquote. You can either manually wrap your lines and put a `>` before every line, or you can let your lines extend naturally. Markdown will handle the wrapping for you, as long as each line of the blockquote starts with a `>`.
> It's a great way to set apart important information or citations.

Nested Blockquotes

You can also nest blockquotes by adding additional > characters.

> This is the first level of a blockquote.
>> This is a nested blockquote, providing a second level of indentation.
> Back to the first level.

Best Practices for Blockquotes:

📋 Lists

Markdown supports both unordered (bulleted) and ordered (numbered) lists, which are essential for organizing information clearly and concisely.

Unordered Lists

Unordered lists can be created using asterisks (*), hyphens (-), or plus signs (+) as list markers. Consistency within a single list is recommended for better readability.

* Item one
* Item two
  * Nested item A
  * Nested item B
* Item three

- Another item one
- Another item two

+ Yet another item one
+ Yet another item two

Ordered Lists

Ordered lists are created by starting each line with a number followed by a period (.). The actual numbers you use don't matter for the rendered output; Markdown will automatically number them correctly. However, it's a good practice to start with 1. for the first item.

1. First item
2. Second item
3. Third item
   1. Nested ordered item
   2. Another nested ordered item
4. Fourth item

1. Even if you use the same number,
1. Markdown will render it correctly.
1. This can be useful for reordering items easily.

Mixing List Types

You can mix unordered and ordered lists, and nest them to create complex structures.

1. Main ordered item
   * Unordered sub-item A
   * Unordered sub-item B
2. Second main ordered item
   1. Ordered sub-item 1
   2. Ordered sub-item 2

Best Practices for Lists:

✅ Task Lists

Task lists (also known as checklists) are a useful extension of Markdown lists, allowing you to create interactive checkboxes within your documents. They are particularly helpful for tracking progress or outlining to-do items.

To create a task list, use a hyphen (-), asterisk (*), or plus sign (+) followed by a space, then square brackets ([]). Inside the brackets, an x (case-insensitive) indicates a checked item, while an empty space indicates an unchecked item.

- [ ] First task to complete (unchecked).
- [ ] Second task that needs done (unchecked).
- [x] This task has been completed (checked).
* [X] Another completed task (case-insensitive 'x').

When rendered, these will typically appear as HTML checkboxes that can be toggled.

Best Practices for Task Lists:

💻 Code Blocks

Code blocks are essential for displaying source code or pre-formatted text. Markdown supports two primary ways to create code blocks: inline code and fenced code blocks.

Inline Code

For short snippets of code within a line of text, use single backticks (```).

Use the `console.log()` function to debug.

Fenced Code Blocks

For larger blocks of code, use fenced code blocks. These are created by placing three or more backticks (\``) or tildes (~~~`) on the lines before and after the code block. This method is preferred as it allows for syntax highlighting.

\`\`\`ruby
  def foobar
      puts "Hello world!"
  end
\`\`\`

\`\`\`javascript
function greet(name) {
  return \`Hello, ${name}!\`
}
\`\`\`

Syntax Highlighting:

You can specify the programming language immediately after the opening fence (e.g., \``ruby`). This enables syntax highlighting, making the code more readable and visually distinct.

Best Practices for Code Blocks:

📐 Math Equations

ShareBin now supports mathematical expressions using KaTeX, allowing you to render beautiful mathematical notation in your pastes. This is perfect for academic content, scientific documentation, or any content that requires mathematical expressions.

Inline Math

For mathematical expressions within a paragraph, use single dollar signs ($):

The quadratic formula is $x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}$.

Einstein's famous equation is $E = mc^2$.

Display Math

For larger mathematical expressions that should be displayed on their own line and centered, use double dollar signs ($$):

$$
\int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi}
$$

$$
\begin{bmatrix}
a & b \\
c & d
\end{bmatrix}
\begin{bmatrix}
x \\
y
\end{bmatrix}
=
\begin{bmatrix}
ax + by \\
cx + dy
\end{bmatrix}
$$

Common Mathematical Notation

Here are some examples of mathematical notation you can use:

Greek Letters:

$\alpha$, $\beta$, $\gamma$, $\Gamma$, $\pi$, $\Pi$, $\phi$, $\varphi$, $\mu$, $\Phi$

Fractions and Roots:

$\frac{1}{2}$, $\frac{x+1}{x-1}$, $\sqrt{x}$, $\sqrt[3]{x}$, $\sqrt[n]{x}$

Superscripts and Subscripts:

$x^2$, $x^{n+1}$, $x_1$, $x_{i,j}$, $a_n^2$

Sums and Integrals:

$\sum_{i=1}^{n} x_i$, $\int_0^1 f(x) dx$, $\prod_{i=1}^{n} x_i$

Set Notation:

$\{1, 2, 3\}$, $x \in S$, $A \cup B$, $A \cap B$, $A \subset B$

Logic and Relations:

$\forall x$, $\exists y$, $\neg p$, $p \land q$, $p \lor q$, $p \implies q$

Best Practices for Math:

➖ Horizontal Rule

A horizontal rule (also known as a thematic break) is used to visually separate content sections within a document. It renders as a horizontal line across the page.

You can create a horizontal rule using three or more hyphens (---), asterisks (***), or underscores (___) on a line by themselves, with or without spaces between them.

***

---

- - -

****************

Best Practices for Horizontal Rules:

Links are fundamental for connecting information within and outside your ShareBin pastes. Markdown provides several ways to create hyperlinks.

Inline links are the most common type. Enclose the link text in square brackets ([]) immediately followed by the URL in parentheses (()). An optional title, which appears as a tooltip on hover, can be added in quotes after the URL.

[Click me!](http://test.com/)

[Click me!](http://test.com/ "Link to Test.com")

Relative Paths

You can also use relative paths for links within the same project or website, which is useful for navigation between ShareBin pastes or other internal resources.

Relative paths work too:
[Go to music](/music/).

Reference-style links allow you to define your URLs separately from the link text, which can improve readability for documents with many links or repeated links. The link definition can be placed anywhere in the document.

[Click this link][link1] for more info about it!
[Also check out this link][foobar] if you want to.

[link1]: http://test.com/ "Cool!"
[foobar]: http://foobar.biz/ "Alright!"

Best Practices for Links:

📑 Table of Contents

A Table of Contents (TOC) greatly enhances the navigability of longer Markdown documents, allowing readers to quickly jump to relevant sections.

Manual Table of Contents

You can manually create a table of contents by linking to your headings. Markdown automatically generates anchors for headings, typically by converting the heading text to lowercase and replacing spaces with hyphens.

- [Heading](#heading)
- [Another heading](#another-heading)
- [Chapter](#chapter)
  - [Subchapter](#subchapter)

Automatic Table of Contents

ShareBin offers a convenient way to automatically generate a table of contents using the [ [[TOC]]] <- (remove the space) token. This feature dynamically creates a TOC based on all headings in your document, simplifying the process for you.

For example, by simply typing this:

Here is the table of contents:


ShareBin will automatically generate a comprehensive table of contents containing all headings found within your document.

Best Practices for Table of Contents:

🖼️ Images

Images are crucial for visual communication and can significantly enhance your Markdown documents. Markdown provides a straightforward syntax for embedding images.

To embed an image, use an exclamation mark (!) followed by the alt text in square brackets ([]), and then the image URL in parentheses (()). An optional title, which appears as a tooltip on hover, can be added in quotes after the URL.

![This is the alt-attribute for my image](http://imgur.com/myimage.jpg "An optional title")

Components of an Image Tag:

Best Practices for Images:

📊 Tables

Tables are an excellent way to present structured data in a clear and organized manner within your Markdown documents.

Basic Table Structure

To create a table, use hyphens (-) to separate the header from the rest of the table, and pipes (|) to delineate columns. The number of hyphens in the separator line doesn't matter, as long as there's at least one for each column.

| Header 1 | Header 2 | Header 3 |
| -------- | -------- | -------- |
| Row 1 Col 1 | Row 1 Col 2 | Row 1 Col 3 |
| Row 2 Col 1 | Row 2 Col 2 | Row 2 Col 3 |

Column Alignment

You can control the alignment of text within each column by adding colons (:) to the separator line:

| Left-aligned | Centered | Right-aligned |
| :----------- | :------: | ------------: |
| Data 1       | Data 2   | Data 3        |
| More Data    | More     | Even More     |

Minimal Table Syntax

While it's good practice to align your pipes for readability in the Markdown source, it's not strictly necessary. Markdown will render the table correctly even with minimal spacing.

Col 1|Col2|Col3
:--|:-:|--:
Ugh this is so ugly|make it|stop

Best Practices for Tables:

This concludes the ShareBin guide. We hope this comprehensive overview helps you create effective and well-structured Markdown pastes. Happy pasting!