Skip to content

Instantly share code, notes, and snippets.

@Fred-Vatin
Last active December 7, 2023 02:39
Show Gist options
  • Save Fred-Vatin/ded2c03d0a11fc656e3004a56d0d36ee to your computer and use it in GitHub Desktop.
Save Fred-Vatin/ded2c03d0a11fc656e3004a56d0d36ee to your computer and use it in GitHub Desktop.
Check the raw file to know the adoc syntax used

DOCUMENT TITLE

First section level 1

Asciidoc always create a #toc id.

Reference here

Check the raw file to see how this is done.

Paragraphs

Create paragraphs by separating them with a blank line.

Create a monospaced paragraph by preceding it with one space.

Hard lines break 1 followed by
line 2 at the same level.

Text format

This text is crossed out

superscript

subscript

It has strong significance to me.

I cannot stress this enough.

Type OK to accept.

That really has to go.

Can’t pick one? Let’s use them all.

Literal (code)

Normal line.

Indent line by one space to create a literal line.

Normal line.

Output literal monospace text, such as {backtick} or http://localhost:8080, by enclosing the text in a pair of pluses surrounded by a pair backticks.

Write [command]`test` outputs test

Literal block is enclosed with ....

let randomNumber = Math.floor(Math.random() * 100) + 1;

let guesses = document.querySelector(".guesses");
let lastResult = document.querySelector(".lastResult");
let lowOrHi = document.querySelector(".lowOrHi");

let guessSubmit = document.querySelector(".guessSubmit");
let guessField = document.querySelector(".guessField");

let guessCount = 1;
let resetButton;

The markdown syntax to write code works too.

Source block with callouts
require 'sinatra' // (1)

get '/hi' do //      (2)
  "Hello World!" //  (3)
end
  1. Library import

  2. URL mapping

  3. HTTP response body

Collapsible blocks

collapsible block example
Click to reveal the answer

This is the answer.

https://docs.asciidoctor.org/asciidoc/latest/macros/links/[link manual] > link manual

Custom ID doesn’t work in github. To use a cross reference use its name <<First section level 1>> > [First section level 1]

Admonition paragraph

ℹ️
An admonition draws the reader’s attention to auxiliary information.

Here are the other built-in admonition types:

Don’t forget the children!
💡
Look for the warp zone under the bridge.
🔥
Slippery when wet.
⚠️
The software you’re about to use is untested.

Admonition block

ℹ️

An admonition block may contain complex content.

A list
  • one

  • two

  • three

Another paragraph.

Quote

Four score and seven years ago our fathers brought forth on this continent a new nation…​

— Abraham Lincoln
Address delivered at the dedication of the Cemetery at Gettysburg

Checklist

Checklist are list items.

  • ✓ checked

  • ✓ also checked

Description list

First term

The description can be placed on the same line as the term.

Second term

Description of the second term. The description can also start on its own line.

  • ❏ not checked

  • normal list item

Q&A

  1. What is the answer?

    This is the answer.

  2. Are cameras allowed?

    Are backpacks allowed?

    No.

Mixed list

Operating Systems
Linux
  1. Fedora

    • Desktop

  2. Ubuntu

    • Desktop

    • Server

BSD
  1. FreeBSD

  2. NetBSD

Cloud Providers
PaaS
  1. OpenShift

  2. CloudBees

IaaS
  1. Amazon EC2

  2. Rackspace

Complex list case

  • Every list item has at least one paragraph of content, which may be wrapped, even using a hanging indent.

    Additional paragraphs or blocks are adjoined by putting a list continuation on a line adjacent to both blocks.

    list continuation

    a plus sign (+) on a line by itself

  • A literal paragraph does not require a list continuation.

    $ cd projects/my-book
  • AsciiDoc lists may contain any complex content.

    Column 1, Header Row Column 2, Header Row

    Column 1, Row 1

    Column 2, Row 1

Image

Set width and height, link and caption.

Sunset
Figure 1: A mountain sunset

Passthrough (write html)

++++
<p>
Content in a passthrough block is passed to the output unprocessed.
That means you can include raw HTML, like this embedded Gist. Github support is limited. No CSS supported. Only basic html tags.
</p>
++++

underline me is underlined.

underline me is also underlined.

Tables

ref

Table 1. Table Title
Column 1, Header Row Column 2, Header Row

Cell in column 1, row 1

Cell in column 2, row 1

Cell in column 1, row 2

Cell in column 2, row 2

Name of Column 1 Name of Column 2

Cell in column 1, row 1

Cell in column 2, row 1

Cell in column 1, row 2

Cell in column 2, row 2

Table 2. Applications
Name Category Description

Firefox

Browser

Mozilla Firefox is an open source web browser. It’s designed for standards compliance, performance, portability.

Arquillian

Testing

An innovative and highly extensible testing platform. Empowers developers to easily create real, automated tests.

Firefox

Browser

Mozilla Firefox is an open source web browser.

It’s designed for:

  • standards compliance

  • performance

  • portability

Artist Track Genre

Baauer

Harlem Shake

Hip Hop

1

2

3

4

5

6

7

8

9

10

ID

  • Goal 1

  • Goal 2

monospace text

free the world

A paragraph

To chekc the custom ID’s for the elements above, open the devtool. Ignore the user-content prefix added by github when you want to reference the custom ID’s.

Comments

// A single-line comment

////
A multi-line comment.

Notice it's a delimited block.
////

Attributes

Check out Asciidoctor!

AsciiDoc is a mature, plain-text document format for writing notes, articles, documentation, books, and more. It’s also a text processor & toolchain for translating documents into various output formats (i.e., backends), including HTML, DocBook, PDF and ePub.

Be sure to read the documentation too!

[✔] That’s done!

Bibliography

The Pragmatic Programmer [pp] should be required reading for all developers. To learn all about design patterns, refer to the book by the “Gang of Four” [gang].

References

  • [pp] Andy Hunt & Dave Thomas. The Pragmatic Programmer: From Journeyman to Master. Addison-Wesley. 1999.

  • [gang] Erich Gamma, Richard Helm, Ralph Johnson & John Vlissides. Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley. 1994.

foot notes

A statement.[1]

A bold statement![2]

Another bold statement.[2]


1. Clarification about this statement.
2. Opinions are my own.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment