SlideShare a Scribd company logo
10 Useful Asciidoctor Tips 
Andres Almiray 
Canoo Engineering AG 
#devoxx #asciidoctor_tips @aalmiray
#devoxx #asciidoctor_tips @aalmiray
#1 Live Reload + Browser Extension 
• http://livereload.com/ 
! 
• https://github.com/asciidoctor/asciidoctor-chrome-extension 
! 
• https://github.com/asciidoctor/asciidoctor-firefox-addon 
#devoxx #asciidoctor_tips @aalmiray
#2 Build Tool integration 
• https://github.com/asciidoctor/asciidoctor-maven-plugin 
! 
• https://github.com/asciidoctor/asciidoctor-gradle-plugin 
! 
• https://github.com/aalmiray/livereload-gradle-plugin 
#devoxx #asciidoctor_tips @aalmiray
#3 Provide a _links.adoc file 
• Use an attribute per link 
• Include the _links.adoc file at the beginning of your index file 
// 
_links.adoc 
:link_gradle: 
http://www.gradle.org/[Gradle, 
window="_blank"] 
:link_maven: 
http://maven.apache.org/[Maven, 
window="_blank"] 
// 
index.adoc 
include::_links.adoc[] 
! 
Asciidoctor 
has 
great 
integration 
with 
{link_gradle} 
and 
{link_maven}. 
#devoxx #asciidoctor_tips @aalmiray
#4 Blank lines at top and bottom 
• Simplifies including files into others 
// 
without 
blank 
lines 
// 
with 
blank 
lines 
// 
index.adoc 
// 
index.adoc 
! 
! 
include::chapter1.adoc[] 
include::chapter1.adoc[] 
! 
include::chapter2.adoc[] 
include::chapter2.adoc[] 
include::chapter3.adoc[] 
! 
include::chapter3.adoc[] 
#devoxx #asciidoctor_tips @aalmiray
#5 Comment your documentation! 
• Yes, comments on documentation ;-) 
= 
Chapter 
Title 
The 
following 
chapter 
discusses 
lorem 
ipsum 
dolor 
sit 
amet 
consecutur 
ad 
nauseam. 
// 
IDEA: 
insert 
a 
lorem 
ipsum 
generator 
here? 
! 
Lorem 
ipsum 
dolor 
sit 
amet 
consecutur. 
Lorem 
ipsum 
dolor 
sit 
amet 
consecutur. 
Lorem 
ipsum 
dolor 
sit 
amet 
consecutur. 
Lorem 
ipsum 
dolor 
sit 
amet 
consecutur. 
! 
//// 
Why 
build 
a 
custom 
lorem-­‐ipsum 
extension 
when 
copy&paste 
is 
so 
cheap? 
No 
need 
to 
tire 
those 
cell 
brains. 
Oh 
look, 
beer! 
//// 
#devoxx #asciidoctor_tips @aalmiray
#6 Use conditional blocks 
• ifdef::attribute_name[] checks if attribute has a value 
• ifndef::attribute_name[] performs the opposite check 
• ifeval::[{attribute_name} > 2] evaluates the attribute 
! 
• You can surround blocks if ifdef/ifndef/ifeval & endif 
• These are great for conditionally rendering content based on 
build variables (see tip #2). 
#devoxx #asciidoctor_tips @aalmiray
#7 Callouts in paragraphs 
• Apply the following inside any paragraph 
[conum,data-value=2]_2_ 
where 2 can be any number 
! 
• Reverse engineered from 
<em class="conum">2</em> 
#devoxx #asciidoctor_tips @aalmiray
#8 Include Raw Content 
• Either use the pass:[] macro or the ++++ block 
pass:[<iframe 
src=“http://secr.et/not/a/malicious/page/honest.html”></iframe>] 
! 
++++ 
<script 
type="text/javascript"> 
var 
pageTracker 
= 
_gat._getTracker("XX-­‐123456-­‐1"); 
pageTracker._initData(); 
pageTracker._trackPageview(); 
</script> 
++++ 
#devoxx #asciidoctor_tips @aalmiray
#9 The Include Macro is Awesome 
• Include any file. 
• Apply call outs in source code. Use standard code comments 
• Change indentation; include certain lines, tags 
.src/main/java/sample/Foo.java 
[source,java,linenums,options="nowrap"] 
-­‐-­‐-­‐-­‐ 
include::{rootdir}/src/main/java/sample/Foo.java[lines=16..-­‐1] 
-­‐-­‐-­‐-­‐ 
<1> 
Define 
the 
class 
<2> 
Properties 
<3> 
Business 
methods 
#devoxx #asciidoctor_tips @aalmiray
#10 Follow Mr. HAKI’s blog 
• @mrhaki blogs periodically at 
http://mrhaki.blogspot.ch/search/label/Asciidoc 
! 
• Lots of useful tricks and exercises on brand new features 
#devoxx #asciidoctor_tips @aalmiray
10 Useful Asciidoctor Tips 
Andres Almiray 
Canoo Engineering AG 
#devoxx #asciidoctor_tips @aalmiray

More Related Content

PDF
Apache Web Server Complete Guide
PDF
Niveles de ejecución arranque y parada de los servicios
PPTX
Mini agenda personal en visual basic
PPT
Cent-OS - Sistema Operacional
PDF
Asciidoctor, because documentation does not have to suck
PDF
Document like the Spring team using Asciidoctor
PDF
Documentation brought to life: Asciidoctor & Gradle (Greach 2015)
PDF
Zurich 2016 eclipse demo camp - asciidoc and docker
Apache Web Server Complete Guide
Niveles de ejecución arranque y parada de los servicios
Mini agenda personal en visual basic
Cent-OS - Sistema Operacional
Asciidoctor, because documentation does not have to suck
Document like the Spring team using Asciidoctor
Documentation brought to life: Asciidoctor & Gradle (Greach 2015)
Zurich 2016 eclipse demo camp - asciidoc and docker

Viewers also liked (16)

PPTX
Mule scopes async_scope
PPTX
Mule mel 3
PPTX
Variables in dataweave
PPTX
Mule data weave_10
PPTX
Mule data weave_7
PDF
Des principes de la démarche DevOps à sa mise en oeuvre
PPT
Mule soft mel_session_3
PDF
Packaging et déploiement d'une application avec Docker et Ansible @DevoxxFR 2015
PDF
Ansible is the simplest way to automate. MoldCamp, 2015
PDF
DevOps avec Ansible et Docker
PDF
Ansible 2.0 のサマライズとこれから
PPTX
Better documentation with asciidoc and asciidoctor
PPTX
Дизайн REST API для высокопроизводительных систем / Александр Лебедев (Новые ...
PPT
Ansible presentation
PDF
reveal.js 3.0.0
PPTX
Jumelage de l'ochv et la roue libre
Mule scopes async_scope
Mule mel 3
Variables in dataweave
Mule data weave_10
Mule data weave_7
Des principes de la démarche DevOps à sa mise en oeuvre
Mule soft mel_session_3
Packaging et déploiement d'une application avec Docker et Ansible @DevoxxFR 2015
Ansible is the simplest way to automate. MoldCamp, 2015
DevOps avec Ansible et Docker
Ansible 2.0 のサマライズとこれから
Better documentation with asciidoc and asciidoctor
Дизайн REST API для высокопроизводительных систем / Александр Лебедев (Новые ...
Ansible presentation
reveal.js 3.0.0
Jumelage de l'ochv et la roue libre
Ad

Similar to 10 Useful Asciidoctor Tips (20)

PDF
BP-6 Repository Customization Best Practices
PDF
Gianluca Varisco - DevOoops (Increase awareness around DevOps infra security)
PDF
Road to Opscon (Pisa '15) - DevOoops
PDF
Front End Development for Back End Developers - Devoxx UK 2017
PDF
Kohana 3.2 documentation
PDF
Web components the future is here
PDF
OWASP SF - Reviewing Modern JavaScript Applications
PPTX
Best Practices for Building WordPress Applications
PDF
How to analyze your codebase with Exakat using Docker - Longhorn PHP
PPTX
Continuous feature-development
PPT
Getting Started With Jenkins And Drupal
PDF
PLAT-16 Using Enterprise Content in Grails
PDF
The Modern Developer Toolbox
PPTX
InSpec For DevOpsDays Amsterdam 2017
KEY
Intro to html5 Boilerplate
PDF
Front End Good Practices
KEY
Going on an HTTP Diet: Front-End Web Performance
PPT
Now That's What I Call WordPress Security 2010
PDF
Developing Liferay Plugins with Maven
BP-6 Repository Customization Best Practices
Gianluca Varisco - DevOoops (Increase awareness around DevOps infra security)
Road to Opscon (Pisa '15) - DevOoops
Front End Development for Back End Developers - Devoxx UK 2017
Kohana 3.2 documentation
Web components the future is here
OWASP SF - Reviewing Modern JavaScript Applications
Best Practices for Building WordPress Applications
How to analyze your codebase with Exakat using Docker - Longhorn PHP
Continuous feature-development
Getting Started With Jenkins And Drupal
PLAT-16 Using Enterprise Content in Grails
The Modern Developer Toolbox
InSpec For DevOpsDays Amsterdam 2017
Intro to html5 Boilerplate
Front End Good Practices
Going on an HTTP Diet: Front-End Web Performance
Now That's What I Call WordPress Security 2010
Developing Liferay Plugins with Maven
Ad

More from Andres Almiray (20)

PDF
Dealing with JSON in the relational world
PDF
Deploying to production with confidence 🚀
PDF
Going beyond ORMs with JSON Relational Duality Views
PDF
Setting up data driven tests with Java tools
PDF
Creando, creciendo, y manteniendo una comunidad de codigo abierto
PDF
Liberando a produccion con confianza
PDF
Liberando a produccion con confidencia
PDF
OracleDB Ecosystem for Java Developers
PDF
Softcon.ph - Maven Puzzlers
PDF
Maven Puzzlers
PDF
Oracle Database Ecosystem for Java Developers
PDF
JReleaser - Releasing at the speed of light
PDF
Building modular applications with the Java Platform Module System and Layrry
PDF
Going Reactive with g rpc
PDF
Building modular applications with JPMS and Layrry
PDF
Taking Micronaut out for a spin
PDF
Apache Groovy's Metaprogramming Options and You
PDF
What I wish I knew about Maven years ago
PDF
What I wish I knew about maven years ago
PDF
The impact of sci fi in tech
Dealing with JSON in the relational world
Deploying to production with confidence 🚀
Going beyond ORMs with JSON Relational Duality Views
Setting up data driven tests with Java tools
Creando, creciendo, y manteniendo una comunidad de codigo abierto
Liberando a produccion con confianza
Liberando a produccion con confidencia
OracleDB Ecosystem for Java Developers
Softcon.ph - Maven Puzzlers
Maven Puzzlers
Oracle Database Ecosystem for Java Developers
JReleaser - Releasing at the speed of light
Building modular applications with the Java Platform Module System and Layrry
Going Reactive with g rpc
Building modular applications with JPMS and Layrry
Taking Micronaut out for a spin
Apache Groovy's Metaprogramming Options and You
What I wish I knew about Maven years ago
What I wish I knew about maven years ago
The impact of sci fi in tech

10 Useful Asciidoctor Tips

  • 1. 10 Useful Asciidoctor Tips Andres Almiray Canoo Engineering AG #devoxx #asciidoctor_tips @aalmiray
  • 3. #1 Live Reload + Browser Extension • http://livereload.com/ ! • https://github.com/asciidoctor/asciidoctor-chrome-extension ! • https://github.com/asciidoctor/asciidoctor-firefox-addon #devoxx #asciidoctor_tips @aalmiray
  • 4. #2 Build Tool integration • https://github.com/asciidoctor/asciidoctor-maven-plugin ! • https://github.com/asciidoctor/asciidoctor-gradle-plugin ! • https://github.com/aalmiray/livereload-gradle-plugin #devoxx #asciidoctor_tips @aalmiray
  • 5. #3 Provide a _links.adoc file • Use an attribute per link • Include the _links.adoc file at the beginning of your index file // _links.adoc :link_gradle: http://www.gradle.org/[Gradle, window="_blank"] :link_maven: http://maven.apache.org/[Maven, window="_blank"] // index.adoc include::_links.adoc[] ! Asciidoctor has great integration with {link_gradle} and {link_maven}. #devoxx #asciidoctor_tips @aalmiray
  • 6. #4 Blank lines at top and bottom • Simplifies including files into others // without blank lines // with blank lines // index.adoc // index.adoc ! ! include::chapter1.adoc[] include::chapter1.adoc[] ! include::chapter2.adoc[] include::chapter2.adoc[] include::chapter3.adoc[] ! include::chapter3.adoc[] #devoxx #asciidoctor_tips @aalmiray
  • 7. #5 Comment your documentation! • Yes, comments on documentation ;-) = Chapter Title The following chapter discusses lorem ipsum dolor sit amet consecutur ad nauseam. // IDEA: insert a lorem ipsum generator here? ! Lorem ipsum dolor sit amet consecutur. Lorem ipsum dolor sit amet consecutur. Lorem ipsum dolor sit amet consecutur. Lorem ipsum dolor sit amet consecutur. ! //// Why build a custom lorem-­‐ipsum extension when copy&paste is so cheap? No need to tire those cell brains. Oh look, beer! //// #devoxx #asciidoctor_tips @aalmiray
  • 8. #6 Use conditional blocks • ifdef::attribute_name[] checks if attribute has a value • ifndef::attribute_name[] performs the opposite check • ifeval::[{attribute_name} > 2] evaluates the attribute ! • You can surround blocks if ifdef/ifndef/ifeval & endif • These are great for conditionally rendering content based on build variables (see tip #2). #devoxx #asciidoctor_tips @aalmiray
  • 9. #7 Callouts in paragraphs • Apply the following inside any paragraph [conum,data-value=2]_2_ where 2 can be any number ! • Reverse engineered from <em class="conum">2</em> #devoxx #asciidoctor_tips @aalmiray
  • 10. #8 Include Raw Content • Either use the pass:[] macro or the ++++ block pass:[<iframe src=“http://secr.et/not/a/malicious/page/honest.html”></iframe>] ! ++++ <script type="text/javascript"> var pageTracker = _gat._getTracker("XX-­‐123456-­‐1"); pageTracker._initData(); pageTracker._trackPageview(); </script> ++++ #devoxx #asciidoctor_tips @aalmiray
  • 11. #9 The Include Macro is Awesome • Include any file. • Apply call outs in source code. Use standard code comments • Change indentation; include certain lines, tags .src/main/java/sample/Foo.java [source,java,linenums,options="nowrap"] -­‐-­‐-­‐-­‐ include::{rootdir}/src/main/java/sample/Foo.java[lines=16..-­‐1] -­‐-­‐-­‐-­‐ <1> Define the class <2> Properties <3> Business methods #devoxx #asciidoctor_tips @aalmiray
  • 12. #10 Follow Mr. HAKI’s blog • @mrhaki blogs periodically at http://mrhaki.blogspot.ch/search/label/Asciidoc ! • Lots of useful tricks and exercises on brand new features #devoxx #asciidoctor_tips @aalmiray
  • 13. 10 Useful Asciidoctor Tips Andres Almiray Canoo Engineering AG #devoxx #asciidoctor_tips @aalmiray