Asciidoctor open links in new window

Created:
Last Update:

Author: Christoph Stoettner
Read in about 1 min · 134 words

Fountain pen and a notebook

Photo by Aaron Burden | Unsplash

I write most of my documentation with Asciidoctor , so saving some keystrokes is important.

You can add window=_blank to links in your Asciidoctor source.

For example:

* https://www.duckduckgo.com[window=_blank]
* https://www.duckduckgo.com[DuckDuckGo, window=_blank]

So this creates links with the html source:

<ul>
<li>
<p><a href="https://www.duckduckgo.com" class="bare" target="_blank" rel="noopener">https://www.duckduckgo.com</a></p>
</li>
<li>
<p><a href="https://www.duckduckgo.com" target="_blank" rel="noopener">DuckDuckGo</a></p>
</li>
</ul>

The good thing is, that there is a shortcut for this. You can replace window=_blank with a ^:

* https://www.duckduckgo.com[^]
* https://www.duckduckgo.com[DuckDuckGo^]

Following html source is generated

<ul>
<li>
<p><a href="https://www.duckduckgo.com" class="bare" target="_blank" rel="noopener">https://www.duckduckgo.com</a></p>
</li>
<li>
<p><a href="https://www.duckduckgo.com" target="_blank" rel="noopener">DuckDuckGo</a></p>
</li>
</ul>

You see the result is absolutly the same.

This work also with Antora and was implemented with Asciidoctor 1.5.7 .

Thanks to Dan Allen to mention this in the Antora Gitter Chat .

Author
Suggested Reading
Aaron Burden: Fountain pen and a notebook

During my talk at FrOSCon I wasn’t sure how to install Asciidoctor on Windows. So I tried on a Windows 10 VM.

When you want to use Asciidoctor on a Windows desktop, you need to download the Rubyinstaller and install it.

Now you can open a administrative command window and install with gem install asciidoctor.

Created:
Last Update:
Read in about 1 min
Aaron Burden: Fountain pen and a notebook

I write most of my documents (blog posts, documentation, recipes and so on) with Asciidoctor . Everything is organized in Git repositories.

During GPN 19 (Gulaschprogrammiernacht) I showed how to build html and pdf with a Gitlab CI/CD pipeline . That’s quite handy, but lots of documents I build, I just need locally.

So today I played with WSL2 and a Makefile to build all Asciidoctor files in a directory.

Created:
Last Update:
Read in about 2 min
Aaron Burden: Fountain pen and a notebook

For GPN19 I prepared a second talk on Documentation with any Editor . The talk was based on a previous one from Froscon 13, but the pipeline tooling changed.

This time there was a technical issue during the recording and so there are only the slides available, but you can still watch the video of the Froscon talk: Froscon 13: Documentation with any Editor

Created:
Last Update:
Read in about 8 min