AsciiDoc Tips and Fragments
Updated  2022-January-31

Page contents

News

2022-January-30  Soft launched⁠[1] this evolving⁠[2] article.

This is a work in progress.

 

Why I created this article

Because I have a bad memory, I often need to search the web or the AsciiDoc docs for the information in this article. Now I can just visit this page, which is easy to get to when I’m working on the Infinite Ink website (because, thanks to the hugo server command, this article is available at http://localhost:1313/asciidoc-tips-fragments/ when I’m working on this website).

 

Attributes

To learn about AsciiDoc attributes in general, see:

To learn about custom AsciiDoc attributes, see

 

Some built-in attributes

Built-in document attributes for character replacement
Attribute nameReplacement textAppearance

blank

nothing

empty

nothing

sp

space

nbsp

 

 

zwsp

​

wj

⁠

apos

'

'

quot

"

"

lsquo

‘

rsquo

’

ldquo

“

rdquo

”

deg

°

°

plus

+

+

brvbar

¦

¦

vbar

|

|

amp

&

&

lt

<

<

gt

>

>

startsb

[

[

endsb

]

]

caret

^

^

asterisk

*

*

tilde

~

~

backslash

\

\

backtick

`

`

two-colons

::

::

two-semicolons

;;

;;

cpp

C++

C++

pp

&#43;&#43;

++

 

Some of my custom attributes

In addition to the above built-in attributes, I define the following custom attributes.

Specified in "AsciiDoc header" of .adoc file
:octothorpe: &#35;
:colon: &#58;
:rsolidus: &#92;
:underscore: &#95;
:3dashes: pass:q[<nobr>`---`</nobr>]
:4dashes: pass:q[<nobr>`----`</nobr>]

When coding in AsciiDoc, you reference attributes using syntax like this:

Fragment of .adoc file
// A line starting with slash slash (//) is a comment

// Some built-in attributes
{asterisk}
{tilde}

// Some Infinite Ink custom attributes
{octothorpe}
{colon}
{rsolidus}
{underscore}
{3dashes}
{4dashes}

Asciidoctor can transform the above AsciiDoc source fragment to HTML that is rendered like the following in your web browser:

Result

* ~

# : \ _ --- ----

 

Assign multiple IDs to a section

The source code of Infinite Ink’s qutebrowser Tips and Fragments includes this section heading:

[[_wsl]]
== Calling a bash script from a Windows userscript[[_gitbash]]

Note:

  • _wsl is the primary ID

  • _gitbash is the secondary ID

 

With the above section heading code, each of the following is true.

  1. Both of the next two AsciiDoc source code fragments link to this section heading:

    link:/qutebrowser-tips-fragments/#_wsl[userscript on Windows]
    link:/qutebrowser-tips-fragments/#_gitbash[userscript on Windows]
  2. In the Asciidoctor-generated table of contents, the next (primary) link is used:

    link:/qutebrowser-tips-fragments/#_wsl[Calling a bash script from a Windows userscript]

 

If you’re interested in this topic, here’s a live link: Calling a bash script from a Windows userscript.

 

Includes

Indenting

(to be written)

 

Level offsetting

(to be written)

 

See also

Endnotes


1. An Infinite Ink article that is soft launched is not listed on Infinite Ink’s Hugo-⁠generated sitemap or home page.
2. Many Infinite Ink articles, including this one, are evergreen and regularly updated.

Comments and questions 📝 🤔 👎 👍

Your public comment or question might immediately improve this page or help me to (eventually) improve this page.