logo
eng-flag

Comprehensive Asciidoc Cheatsheet

Basic Formatting

Bold and Italic

  • Bold: bold text or bold text
  • Italic: italic text or italic text
  • Bold and Italic: bold and italic or bold and italic

Example: This is bold, this is italic, and this is bold and italic.

Monospace

Use backticks for inline monospace: monospace text

Example: This is monospace text.

Strikethrough

Use double hyphens: [line-through]#strikethrough text#

Example: This is [line-through]#strikethrough# text.

Superscript and Subscript

  • Superscript: ^superscript^
  • Subscript: subscript

Example: H2O is water and E = mc^2^ is Einstein's famous equation.

Headings

Use equals signs (=) for headings. The number of equals signs determines the level of the heading.

= Document Title (Level 0) == Level 1 Section === Level 2 Section ==== Level 3 Section ===== Level 4 Section ====== Level 5 Section

Lists

Unordered Lists

Use asterisks (*), hyphens (-), or plus signs (+) for unordered lists.

  • Item 1
  • Item 2 ** Subitem 2.1 ** Subitem 2.2
  • Item 3

Example:

  • Fruits ** Apple ** Banana
  • Vegetables ** Carrot ** Broccoli

Ordered Lists

Use periods (.) for ordered lists.

. First item . Second item .. Subitem 2.1 .. Subitem 2.2 . Third item

Example: . Mix ingredients . Bake for 20 minutes .. Check after 15 minutes .. Add 5 more minutes if needed . Let it cool . Serve

Description Lists

Use double colons (::) for description lists.

Term 1:: Definition 1 Term 2:: Definition 2 Term 3:: Definition 3

Example: CPU:: Central Processing Unit RAM:: Random Access Memory GPU:: Graphics Processing Unit

Use square brackets and parentheses for external links: Link text

Example: Visit Asciidoctor for more information.

Internal Cross-references

Use double angle brackets and the section ID for internal cross-references: <<section-id,Custom Label>>

Example: See <<basic-formatting,Basic Formatting>> for more details.

Code Blocks

Use four hyphens (----) to create a code block:


def hello_world(): print("Hello, World!")

For syntax highlighting, specify the language after the opening hyphens:

[source,python]

def hello_world(): print("Hello, World!")

Tables

Use the pipe character (|) to create tables:

|=== | Header 1 | Header 2 | Header 3

| Row 1, Cell 1 | Row 1, Cell 2 | Row 1, Cell 3

| Row 2, Cell 1 | Row 2, Cell 2 | Row 2, Cell 2 |===

Example: |=== | Name | Age | Occupation

| John Doe | 30 | Software Developer

| Jane Smith | 28 | Data Scientist

| Bob Johnson | 35 | Project Manager |===

Images

Use the image macro to insert images:

image::path/to/image.jpg[Alt text]

Example: image::https://example.com/asciidoc-logo.png[Asciidoc Logo]

Admonitions

Use the following syntax for admonitions:

NOTE: This is a note admonition.

TIP: This is a tip admonition.

IMPORTANT: This is an important admonition.

WARNING: This is a warning admonition.

CAUTION: This is a caution admonition.

Quotes

Use the following syntax for block quotes:

[quote, Author Name, Source]


This is a block quote. It can span multiple lines.


Example: [quote, Albert Einstein]


Two things are infinite: the universe and human stupidity; and I'm not sure about the universe.


Footnotes

Use square brackets with a caret (^) for footnotes:

This is a sentence with a footnote.1

Horizontal Rules

Use three or more hyphens, asterisks, or underscores on a line by themselves:




Comments

Use double forward slashes for single-line comments:

// This is a single-line comment

Use four forward slashes for multi-line comments:

//// This is a multi-line comment ////

Mathematical Equations

Use the stem macro for inline equations:

stem:[sqrt{x^2 + y^2}]

For block equations, use:

[stem] ++++ \int_{0}^{\infty} e^{-x^2} dx = \frac{\sqrt{\pi}}{2} ++++

Include Files

Use the include directive to include other files:

include::path/to/file.adoc[]

Conditional Processing

Use ifdef and ifndef directives for conditional processing:

ifdef::attr-name[] This content will only appear if 'attr-name' is defined. endif::attr-name[]

ifndef::attr-name[] This content will only appear if 'attr-name' is not defined. endif::attr-name[]

Custom Attributes

Define custom attributes using the :name: syntax:

:author: John Doe :version: 1.0.0

Use attributes with the {name} syntax:

This document was written by {author} (version {version}).

Footnotes

  1. This is the footnote content.

2024 © All rights reserved - buraxta.com