Build beautiful presentations with asciidoctor and reveal.js
I've been a long time looking for an excuse to really use asciidoctor to build presentations. Now that I have the opportunities, I've been enjoying it like a child. For my memory, and for yoy, if you want to use it, here are my tips.
This helps me write in source code (asciidoc), version it, and export it to html presentations with animations, icons, style and glamour (code appearing from nowere and auto highlighter ). And all of this without having to care about alignment!!
ℹ️
I'm using the version 5.0.0-rc.1 of
asciidoctor-reveal.js
converter. ⚠️
WARNING: I've been having issues to print to PDF correctly. I've only managed it with microsoft edge, though most of people was successful with chrome. Just be careful and test it if you need to export to PDF
Main file & Styling
= My great slide
:author: Yourname here
:icons: font
:imagesdir: images/
// reveal.js config
//:revealjsdir: https://cdnjs.cloudflare.com/ajax/libs/reveal.js/4.1.2
:revealjsdir: reveal.js
:customcss: css/reveal-override.css
:revealjs_theme: white
:revealjs_hash: true
:revealjs_width: 1408
:revealjs_height: 792
:revealjs_slideNumber: true
:revealjs_pdfSeparateFragments: false
:revealjs_controlsBackArrows: faded
// Highliter
:source-highlighter: highlightjs
:highlightjs-languages: asciidoc, python, yaml
//:highlightjs-theme: a11y-dark.css
:docinfo: private
// Title
:title-slide-background-image: myTitleBackground.png
// Separate sections in different files for better organization
include::s1/intro.adoc[]
include::s1/about-me.adoc[]
include::s1/agenda.adoc[]
Layouts (columns)
Slide extras
[%notitle]
=== This will not appear
Text that will appear.
Steps (appearing)
=== Today's Agenda
[%step]
* Introduction
* Introduction to Infrastructure
* Pause 15 min
=== Course Agenda
* [.step.highlight-red]#Introduction to Big Data#
image:s1/steam-train.jpg[old-train,height=250,step=1]
icon:arrow-right[size=3x]
image:s1/ice-train.jpg[ice-train,height=250,step=2]
Important text
[.important,transition="zoom"]
=== Questions?
[.important%step]
Architecture is about the important stuff... whatever that is.
Code animation and highlight
[%auto-animate]
=== Solution
[source%linenums,python,highlight="1,3",data-id=flask-app]
----
from flask import Flask
app = Flask(__name__)
----
[%auto-animate]
=== Solution
[source%linenums,python,highlight="5..7",data-id=flask-app]
----
from flask import Flask
app = Flask(__name__)
@app.route("/")
def main_page():
return "<p>Hello, World!</p>"
----
[%auto-animate]
=== Solution
[source%linenums,python,highlight="2..4",data-id=flask-app]
----
from flask import Flask
import sqlite3
DB_FILE = "my_app.db"
app = Flask(__name__)
@app.route("/")
def main_page():
return "<p>Hello, World!</p>"
----
Use highlight="1|4..6|8,10"
to highlight 1 in the first step, lines 4 to 6 in the second and 8 and 10 in the last one.
Use data-id=XYZ
to link blocks between slides