Skip to content

[asciidoc/en] Added more examples and updated information #5296

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
139 changes: 126 additions & 13 deletions asciidoc.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ name: AsciiDoc
contributors:
- ["Ryan Mavilia", "http://unoriginality.rocks/"]
- ["Abel Salgado Romero", "https://twitter.com/abelsromero"]
- ["Mykolas Bamberg", "https://github.com/MykBamberg"]
filename: asciidoc.adoc
---

AsciiDoc is a markup language similar to Markdown and it can be used for anything from books to blogs. Created in 2002 by Stuart Rackham the language is simple but it allows for a great amount of customization.

Document Header
**Document Header**

Headers are optional and can't contain blank lines. It must be offset from content by at least one blank line.

Expand Down Expand Up @@ -48,28 +49,61 @@ v1.0, 2016-01-13
This article about chips is going to be fun.
```

Paragraphs
**Comments**

```
// AsciiDoc offers line comments, beginning with a double slash

////
and block comments enclosed
by four-slash delimiters
which can span multiple lines
////
```

**Built-in Document Attributes**

```
= Document Title
// Document attributes change different behaviors of the document
// These are commonly used to
:imagesdir: ./images
:iconsdir: ./icons
// set resource directories,
:toc:
// enable an automatic table of contents,
:notitle:
// hide the document title,
:sectnums:
// automatically number document sections,
:source-highlighter: pygments
// set a source code highlighter
```

**Paragraphs**

```
You don't need anything special for paragraphs.

Add a blank line between paragraphs to separate them.

To create a line blank add a +
and you will receive a line break!
To create a line break within a paragraph add a +
to the end of the line and you will receive a line break!
```

Formatting Text
**Formatting Text**

```
_underscore creates italics_
*asterisks for bold*
*_combine for extra fun_*
`use ticks to signify monospace`
`*bolded monospace*`
"`double curved quotes`"
'`single curved quotes`'
```

Section Titles
**Section Titles**

```
= Level 0 (may only be used in document's header)
Expand All @@ -83,17 +117,17 @@ Section Titles
===== Level 4 <h5>
```

Lists
**Lists**

To create a bulleted list use asterisks.
To create an unordered list use asterisks.

```
* foo
* bar
* baz
```

To create a numbered list use periods.
To create an ordered list use periods.

```
. item 1
Expand All @@ -117,15 +151,94 @@ You can nest lists by adding extra asterisks or periods up to five times.
..... foo 5
```

**Source Code Blocks**

```
[source,c]
----
#include <stdio.h>

int main(void) {
printf("AsciiDoc source code blocks are rendered"
"in a fixed-width font with syntax highlighting\n");
}
----
```

**Images**

```
image::image.png[]

.Figure caption
image::image.png["Alt text",128,128]
```

**Tables**

```
// The cols attribute specifies the number and relative width of each
// column. In this case there are two columns with the first having
// Twice the width of the latter.
[cols="2,1"]
|===
|column 1, row 1
|column 2, row 1

|column 1, row 2
|column 2, row 2
|===
```

**Hyperlinks**

```
https://learnxinyminutes.com/

<https://learnxinyminutes.com/>

https://learnxinyminutes.com/[]

https://learnxinyminutes.com/[Learn X in Y minutes]
```

**Text replacements**

Some character sequences are replaced by appropriate Unicode characters

```
* Copyright: (C)
* Registered: (R)
* Trademark: (TM)
* Em dash: --
* Ellipsis: ...
* Arrows: -> => <- <=
```

**Includes**

Include another file's content in the document

```
include::other_asciidoc_file.adoc[]
```

**Horizontal Rule**

```
'''
```

## Further Reading

There are two tools to process AsciiDoc documents:
**Converters**

1. [AsciiDoc](http://asciidoc.org/): original Python implementation available in the main Linux distributions. Stable and currently in maintenance mode.
2. [Asciidoctor](http://asciidoctor.org/): alternative Ruby implementation, usable also from Java and JavaScript. Under active development, it aims to extend the AsciiDoc syntax with new features and output formats.
1. [Asciidoctor](http://asciidoctor.org/): Actively developed reference implementation in Ruby
2. [AsciiDoc.py](http://asciidoc.org/): Legacy implementation supporting an older syntax

Following links are related to `Asciidoctor` implementation:
**Helpful Resources**

* [Markdown - AsciiDoc syntax comparison](http://asciidoctor.org/docs/user-manual/#comparison-by-example): side-by-side comparison of common Markdown and AsciiDoc elements.
* [Getting started](http://asciidoctor.org/docs/#get-started-with-asciidoctor): installation and quick start guides to render simple documents.
* [Asciidoctor User Manual](http://asciidoctor.org/docs/user-manual/): complete single-document manual with syntax reference, examples, rendering tools, amongst others.
* [AsciiDoc Syntax Quick Reference](https://docs.asciidoctor.org/asciidoc/latest/syntax-quick-reference/)