Skip to main content

Asciidoctor open links in new window

·131 words·1 min

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.

Christoph Stoettner
Author
Christoph Stoettner
I work at Vegard IT GmbH as a senior consultant, focusing on collaboration software, Kubernetes, security, and automation. I primarily work with HCL Connections, WebSphere Application Server, Kubernetes, Ansible, Terraform, and Linux. My daily work occasionally leads to technical talks and blog articles, which I share here more or less regularly.

Related

Asciidoctor for Professional Looking Documentation

·1613 words·8 mins
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

Asciidoctor Windows

·127 words·1 min
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.

New Blog Engine

·465 words·3 mins
I switched my blog to Hugo the last days. After nearly 12 years with WordPress, I needed something new. Why did I drop WordPress, one of the most used blog engines in the world? Most used means always most interesting for bad guys. Dynamic pages are slower and can contain more vulnerabilities than static pages (which Hugo generates). Hugo supports git, so I have version control in my posts and design. I can start a small web server locally and test the posts: hugo server -D and the most convenient thing: I can use VIM for editing.