The Codeberg Documentation website is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
It bundles third-party font software licensed under a different license. Please look at the LICENSE file for details.
Changes to the original versions of the article as well as its individual authors can be looked up in this article's commit history
Codeberg and the Codeberg Logo are trademarks of Codeberg e.V.
There are two ways to use monospace preformatted text within your Markdown document:
You can preformat a section of text or code by indenting the code with 4 or more spaces, or a tab.
Using indentation, it's not possible to add a rendering hint. It's also not possible to preformat text within a line using this syntax.
Indentation-based preformatting sometimes causes false positives where text is preformatted that isn't supposed to. For this reason, it is disabled in some Markdown renderers, including in Codeberg Documentation.
A better way of preformatting a section of text is by starting a section of text with one or more backtick characters.
Here, we use 3 backtick characters on its own line, then our text, then another line containing 3 more backticks.
this
is
displayed
as
preformatted
You can also preformat a section of text within a line using backtick syntax.
The following text is for example preformatted
by using the backtick syntax.
Sometime renderers use hints to syntax highlight the code in a preformatted section.
To provide a hint, simply add the language name at the end of the introductory backtick(s).
For example, using shell
as the hint will tell the renderer that the given code should be highlighted as a shell script:
#!/bin/bash
echo "Hello world"
The same thing would be rendered without syntax highlighting if the hint is not given:
#!/bin/bash
echo "Hello world"
Hey there! 👋 Thank you for reading this article!
Is there something missing, or do you have an idea on how to improve the documentation? Do you want to write your own article?
You're invited to contribute to the Codeberg Documentation at its source code repository, for example, by adding a pull request or joining in on the discussion in the issue tracker.
For an introduction on contributing to Codeberg Documentation, please have a look at the Contributor FAQ.
© Codeberg Docs Contributors. See LICENSE