# Python code
def greet(name):
print(f"Hello, {name}!")
greet('World')
AsciiDoc showroom
Here are a few examples to demonstrate what AsciiDoc, as a markup language, has to offer. Its capabilities far exceed those of Markdown. Thus, this page will only cover a small portion to give you a sense of what’s possible.
Checking out the source code of this page can also help you get started with AsciiDoc. For more information, you can refer to the official AsciiDoc and Asciidoctor documentation.
Source code listings
Start
Set counter to 0
While counter < 5 do
Print "This is loop iteration", counter
Increment counter by 1
End
def square(number):(1)
return number ** 2
result = square(4)(2)
print(result)(3)
1 | The function square calculates the square of a given number. |
2 | The function is called with the number 4, and the result is stored in result . |
3 | The result is printed to the console. |
You can also directly insert source code from a file into your AsciiDoc document. This way, you can display the same code in multiple places but only need to update it in one location. You can even embed production code directly.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
HTML boilerplate code.
</body>
</html>
Text formatting
-
Text with strong significance to me
-
Emphasized text
-
Combination of both
-
You can also format parts of a word:
-
Create, Read, Update, and Delete (CRUD)
-
Counterclockwise
-
string
s
-
-
superscript
-
subscript
-
This is strikethrough text
-
This is underlined text
-
monospace text
Links
-
In AsciiDoc, you can easily add links to other articles: Example post for AsciiDoc with explanations.
-
You can also link to sections on the page using link anchors: Link to the section: "Adminition blocks" on this page
Keyboard shortcuts and menu paths
Ctrl+Alt+Del
Admonition blocks
Admonition: TIP .
|
Admonition: IMPORTANT .
|
Admonition blocks (here shown for the admonition: A list with several items.
And even blocks with source code.
|
Admonition: CAUTION .
|
Admonition: WARNING .
|
Tables
Name | Age | City |
---|---|---|
Max Mustermann |
30 |
Berlin |
John Doe |
45 |
New York |
Maria Musterfrau |
28 |
München |
Feature | Description | Example |
---|---|---|
Bold and Italics |
Supports italic and bold text formatting |
Italic and bold formatting |
This cell spans 3 columns |
||
This cell spans 2 rows |
First row of the spanned cell |
Another cell |
Second row of the spanned cell |
Another cell |
|
Links |
Supports links within the table |
Lists
Unordered
-
Item 1
-
Item 2
-
Item 2.1
-
Item 2.2
-
Item 2.3
-
-
Item 3
Numbered
-
Numbered item 1
-
Numbered item 2
-
Numbered item 2.1
-
Numbered item 2.2
-
Numbered item 2.3
-
-
Numbered item 3
Checklist
-
checked:
* [*]
-
checked:
* [x]
(lower case x!)-
checked:
- [*]
-
checked:
- [x]
-
unchecked:
- [ ]
-
-
unchecked:
* [ ]
-
item without checkbox
-
unchecked item on level 2:
** [ ]
-
checked item on level 3:
* [x]
-
-
Quotes
Fully annotated quote:
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
published on https://en.wikipedia.org/wiki/Lorem_ipsum
Quotation lacking attribution and further information:
Veni, vidi, vici.
Glossary
Glossary entries can also contain lists, quotations, code-blocks, …
- Lorem ipsum
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
- Lorem ipsum (with code block)
-
A common form of Lorem ipsum in a code block.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
- Lorem ipsum (with list)
-
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
-
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
-
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
-
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
-
Table of contents (TOC)
As you can see at the top of this page, AsciiDoc can also generate a table of contents for you.
You can enable this directly in the AsciiDoc page attributes. For this page I used:
:toc: preamble
:toclevels: 5
Level 2 corresponds to <h3>
Level 3 corresponds to <h4>
Level 4 corresponds to <h5>
Level 5 corresponds to <h6>
Using Mathematical Formulas (STEM)
In this blog, you can easily use STEM
(Science, Technology, Engineering and Math) expressions in your pages and posts.
To do this, simply add the :stem:
attribute to the document header of your page or post
(You can also enable it for all posts in your _config.yml
):
= Page Title
:stem:
Two syntaxes for the formulas are are available:
-
AsciiMathML (AsciiMath is the default)
Examples using AsciiMath
Inline Command: (here \$[[a,b],[c,d]]((n),(k))\$.
)
\$[[a,b],[c,d]]((n),(k))\$.
Block command:
[asciimath]
++++
sum_(i=1)^n i^3=((n(n+1))/2)^2
++++
Examples using LaTeX
Inline command (here: \(C = \alpha + \beta Y^{\gamma} + \epsilon\)
):
\(C = \alpha + \beta Y^{\gamma} + \epsilon\)
Block command:
[latexmath]
++++
\lim\limits_{x \to \infty} \exp(-x) = 0
++++
Ascii Diagrams
Text-based diagrams enable easy integration with version control systems, as they are saved in plain text. This format avoids binary files, making changes visible in diffs, so you can track updates precisely over time. Additionally, because they are text, different themes and styles can be applied without needing to redesign the diagram. Another benefit is that these diagrams can be generated automatically during the build process, eliminating the need for graphics editors or manual exports to specific formats. This makes them ideal for automated workflows and consistent documentation across projects.
Asciidoctor Diagram supports a wide range of text-based diagram types making it a versatile choice for creating diagrams directly within documentation.
Ditaa
Ideal for converting ASCII art into diagrams, especially useful for quick sketches and block diagrams.
Check the AsciiDoc source of this page to see that the diagram is clearly recognizable even in the text. This is a unique feature of Ditaa.
PlantUML
Great for creating UML diagrams like class diagrams, sequence diagrams, and activity diagrams.
DiagramBlock
and BlockProcessor
classes are related, with DiagramBlock
having subclasses DitaaBlock
and PlantUmlBlock
.Graphviz
Useful for directed and undirected graphs, including flowcharts, state diagrams, and dependency graphs.
Mermaid
mermaid.js is ideal for creating flowcharts, sequence diagrams, Gantt charts, and more.

Lilypond
LilyPond is a music engraving program that enables users to create beautifully typeset sheet music through a text-based input system, focusing on producing high-quality, professional-looking scores suitable for publication.
