2022-04-23 12:18:08 -07:00
|
|
|
---
|
|
|
|
|
eleventyNavigation:
|
|
|
|
|
key: IntroductionToMarkdown
|
|
|
|
|
title: Introduction to Markdown
|
|
|
|
|
parent: Markdown
|
|
|
|
|
order: 20
|
|
|
|
|
---
|
|
|
|
|
|
2025-12-19 11:10:04 -08:00
|
|
|
<!-- markdownlint-disable MD049 MD050 -->
|
|
|
|
|
|
2022-07-22 00:27:57 -07:00
|
|
|
Markdown files are basically normal text files. The file extension `.md` specifies that a file can be rendered as Markdown.
|
|
|
|
|
You can also use Markdown in many parts of Codeberg (Issues, Pull Requests, etc.).
|
2022-04-23 12:18:08 -07:00
|
|
|
|
|
|
|
|
## Text section
|
|
|
|
|
|
2022-07-22 00:27:57 -07:00
|
|
|
To write a Markdown file, simply create a new file, and edit it with a text editor of your choice.
|
2023-07-21 12:02:10 -07:00
|
|
|
Markdown doesn't consider single line breaks as the start of a new paragraph.
|
2022-04-23 12:18:08 -07:00
|
|
|
You can write all your text into one long line or introduce a new line every once in a while.
|
2025-06-14 02:38:21 -07:00
|
|
|
It is common practice to introduce a new line at around 80 characters to enable users to easily read the plain
|
|
|
|
|
un-rendered version of the Markdown file.
|
2022-07-22 00:27:57 -07:00
|
|
|
However, it's recommended to make a line break in Markdown when it makes sense, e.g. at the end of a sentence.
|
2023-07-21 12:02:10 -07:00
|
|
|
It makes diffs easier to understand, as the context of the complete sentence is preserved.
|
2022-04-23 12:18:08 -07:00
|
|
|
|
|
|
|
|
If you want to start a new paragraph, use two or more empty new lines to separate the text.
|
2023-07-17 17:43:47 -07:00
|
|
|
Beware that when rendering with Forgejo, line breaks are rendered differently in repos and comment fields.
|
2022-07-22 00:27:57 -07:00
|
|
|
For example, one line break in a comment leads to a new paragraph.
|
2022-04-23 12:18:08 -07:00
|
|
|
|
|
|
|
|
### Highlighting text sections
|
|
|
|
|
|
2024-06-11 00:51:22 -07:00
|
|
|
In paragraphs, it is possible to highlight passages using **bold** and _italics_.
|
2022-04-23 12:18:08 -07:00
|
|
|
|
|
|
|
|
### Bold
|
|
|
|
|
|
2022-07-22 00:27:57 -07:00
|
|
|
To make text bold, use two asterisks at the start of the section you want to highlight `**`
|
|
|
|
|
At the end of the section, add another two asterisks `**`.
|
|
|
|
|
Alternatively you can use two underscore characters `__` at the beginning and end of the section
|
|
|
|
|
to get the same effect.
|
2022-04-23 12:18:08 -07:00
|
|
|
|
2022-07-22 00:27:57 -07:00
|
|
|
Here are a few examples.
|
2022-04-23 12:18:08 -07:00
|
|
|
|
2025-06-14 06:39:01 -07:00
|
|
|
```markdown
|
2022-07-22 00:27:57 -07:00
|
|
|
This is **bold text**.
|
2022-04-23 12:18:08 -07:00
|
|
|
```
|
|
|
|
|
|
2022-07-22 00:27:57 -07:00
|
|
|
This gets rendered as
|
2022-04-23 12:18:08 -07:00
|
|
|
|
2022-07-22 00:27:57 -07:00
|
|
|
This is **bold text**.
|
2022-04-23 12:18:08 -07:00
|
|
|
|
2025-12-19 11:10:04 -08:00
|
|
|
<!-- prettier-ignore-start -->
|
2025-06-14 06:39:01 -07:00
|
|
|
```markdown
|
2025-12-19 11:10:04 -08:00
|
|
|
This is also __bold text__.
|
2022-04-23 12:18:08 -07:00
|
|
|
```
|
|
|
|
|
|
2022-07-22 00:27:57 -07:00
|
|
|
This gets rendered as
|
2022-04-23 12:18:08 -07:00
|
|
|
|
2025-12-19 11:10:04 -08:00
|
|
|
This is also __bold text__.
|
|
|
|
|
<!-- prettier-ignore-end -->
|
2022-04-23 12:18:08 -07:00
|
|
|
|
|
|
|
|
### Italics
|
|
|
|
|
|
2022-07-22 00:27:57 -07:00
|
|
|
To make text italic use one asterisk at the start of the section you want to highlight `*`
|
|
|
|
|
At the end of the section, add another asterisk `*`.
|
|
|
|
|
Alternatively you can use one underscore character `_` at the beginning and end of the section
|
|
|
|
|
to get the same effect.
|
2022-04-23 12:18:08 -07:00
|
|
|
|
2022-07-22 00:27:57 -07:00
|
|
|
Here are a few examples.
|
2022-04-23 12:18:08 -07:00
|
|
|
|
2025-12-19 11:10:04 -08:00
|
|
|
<!-- prettier-ignore-start -->
|
2025-06-14 06:39:01 -07:00
|
|
|
```markdown
|
2025-12-19 11:10:04 -08:00
|
|
|
This is *italic text*.
|
2022-04-23 12:18:08 -07:00
|
|
|
```
|
|
|
|
|
|
2022-07-22 00:27:57 -07:00
|
|
|
This gets rendered as
|
2022-04-23 12:18:08 -07:00
|
|
|
|
2025-12-19 11:10:04 -08:00
|
|
|
This is *italic text*.
|
|
|
|
|
<!-- prettier-ignore-end -->
|
2022-04-23 12:18:08 -07:00
|
|
|
|
2025-06-14 06:39:01 -07:00
|
|
|
```markdown
|
2022-07-22 00:27:57 -07:00
|
|
|
This is also _italic text_.
|
2022-04-23 12:18:08 -07:00
|
|
|
```
|
|
|
|
|
|
2022-07-22 00:27:57 -07:00
|
|
|
This gets rendered as
|
2022-04-23 12:18:08 -07:00
|
|
|
|
2022-07-22 00:27:57 -07:00
|
|
|
This is also _italic text_.
|
2022-04-23 12:18:08 -07:00
|
|
|
|
2025-12-12 10:32:28 -08:00
|
|
|
### Strikethrough
|
|
|
|
|
|
|
|
|
|
To strikethrough use `~~` around the text.
|
|
|
|
|
|
|
|
|
|
```markdown
|
|
|
|
|
This is ~~strikethrough text~~.
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
is rendered as
|
|
|
|
|
|
|
|
|
|
This is ~~strikethrough text~~.
|
|
|
|
|
|
2026-06-25 05:03:45 -07:00
|
|
|
### Monospaced font (code)
|
|
|
|
|
|
|
|
|
|
_For preformatted code blocks, see "[Preformatted Text](/markdown/preformatted-text)."_
|
|
|
|
|
|
|
|
|
|
It is a common convention in technical writing to use a monospaced or
|
|
|
|
|
fixed-width font to indicate code, literal text to be typed at a command
|
|
|
|
|
prompt, or program output.
|
|
|
|
|
|
|
|
|
|
To create a span of inline text with a monospaced font, wrap the text in
|
|
|
|
|
backtick (\`) characters, like so:
|
|
|
|
|
|
|
|
|
|
```markdown
|
|
|
|
|
This text contains an `inline code` span.
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
which renders as
|
|
|
|
|
|
|
|
|
|
This text contains an `inline code` span.
|
|
|
|
|
|
2025-12-12 10:32:28 -08:00
|
|
|
### Footnotes
|
|
|
|
|
|
|
|
|
|
To add footnotes use the syntax `[^name]` inline, and define them with:<br>
|
2025-12-18 17:12:14 -08:00
|
|
|
`[^name]:text.`
|
2025-12-12 10:32:28 -08:00
|
|
|
|
|
|
|
|
```markdown
|
|
|
|
|
Text with a footnote.[^1]
|
2026-07-12 15:45:22 -07:00
|
|
|
|
2025-12-12 10:32:28 -08:00
|
|
|
[^1]: A footnote.
|
|
|
|
|
```
|
|
|
|
|
|
2025-12-18 17:12:14 -08:00
|
|
|
is rendered as
|
2025-12-12 10:32:28 -08:00
|
|
|
|
2025-12-18 17:12:14 -08:00
|
|
|

|
2025-12-12 10:32:28 -08:00
|
|
|
|
2023-07-17 17:43:47 -07:00
|
|
|
## Forgejo-specific formatting
|
2022-04-23 12:18:08 -07:00
|
|
|
|
|
|
|
|
### Emoticons
|
2024-06-11 00:51:22 -07:00
|
|
|
|
2022-07-22 00:27:57 -07:00
|
|
|
Text may contain references to emoticons which are rendered as a small image, similar to an emoji.
|
|
|
|
|
You can render these by typing the name of the emoticon you want to use, surrounded by colons (`:`), like this `:codeberg:`.
|
2022-04-23 12:18:08 -07:00
|
|
|
|
2025-06-14 02:38:21 -07:00
|
|
|
Some examples are `:codeberg:` which is rendered as
|
|
|
|
|
<img
|
|
|
|
|
src="https://codeberg.org/assets/img/emoji/codeberg.png"
|
|
|
|
|
class="codeberg-design" style="border-style:none;width:1em;height:1em"
|
|
|
|
|
alt="The Codeberg mountain" />
|
|
|
|
|
and `:forgejo:` which is rendered as
|
|
|
|
|
<img
|
|
|
|
|
src="https://codeberg.org/assets/img/emoji/forgejo.png"
|
2025-07-21 04:09:13 -07:00
|
|
|
class="codeberg-design" style="border-style:none;height:1em;width:1em"
|
2025-06-14 02:38:21 -07:00
|
|
|
alt="The forgejo f letter" />.
|
2022-04-23 12:18:08 -07:00
|
|
|
|
2022-07-22 00:27:57 -07:00
|
|
|
### Referencing issues and pull requests
|
2022-04-23 12:18:08 -07:00
|
|
|
|
2025-06-14 02:38:21 -07:00
|
|
|
Issues and pull requests in Codeberg/Forgejo can be referenced in the comments of an issue or a pull request by using a
|
|
|
|
|
hash `#` followed by the number of the issue or pull request.
|
2022-04-23 12:18:08 -07:00
|
|
|
The renderer will then include a link to the referenced issue into the comment.
|
2023-07-21 12:02:10 -07:00
|
|
|
After that, a link to the comment containing the reference will be added to the issues referenced in this way.
|
2022-04-23 12:18:08 -07:00
|
|
|
|
|
|
|
|
### Checkboxes
|
|
|
|
|
|
2025-12-13 07:59:10 -08:00
|
|
|
You can add checkboxes to comments by using list items with a space surrounded by square brackets `- [ ]`. These can be
|
|
|
|
|
checked/unchecked later without editing the comment.
|
2022-04-23 12:18:08 -07:00
|
|
|
This can for example be useful when creating a Todo list.
|
|
|
|
|
|
|
|
|
|
### Mermaid diagrams
|
|
|
|
|
|
2023-07-17 17:43:47 -07:00
|
|
|
Forgejo can render [Mermaid diagrams](https://mermaid-js.github.io/mermaid/#/) in issues, pull requests and comments.
|
2022-04-23 12:18:08 -07:00
|
|
|
|
2022-07-22 00:27:57 -07:00
|
|
|
Use the render hint `mermaid` on the preformatted section containing the code of the mermaid diagram.
|
2022-04-23 12:18:08 -07:00
|
|
|
|
|
|
|
|
E.g.
|
|
|
|
|
|
2024-06-11 00:51:22 -07:00
|
|
|
````markdown
|
|
|
|
|
```mermaid
|
|
|
|
|
graph TD;
|
|
|
|
|
A(stuff)-->B[one];
|
|
|
|
|
A-->C[two];
|
|
|
|
|
A-->D[three];
|
|
|
|
|
```
|
|
|
|
|
````
|
2022-04-23 12:18:08 -07:00
|
|
|
|
|
|
|
|
is rendered to:
|
|
|
|
|
|
2024-11-28 22:12:05 -08:00
|
|
|

|