marc-etienne / asciidoctor-backends

Backends (i.e., templates) for Asciidoctor, a Ruby port of AsciiDoc.

Home Page:http://asciidoctor.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Asciidoctor Backends

This repository hosts an assortment of backends (i.e., templates) for Asciidoctor, a pure Ruby port of the AsciiDoc markup language.

In this repository, you’ll find replicas of both the html5 and docbook45 backends from AsciiDoc (and Asciidoctor) written in both Haml and Slim, as well as backends for generating HTML5 presentations from AsciiDoc.

General Usage Instructions

Coming soon…​

deck.js Backend

The deck.js backend is a collection of Haml templates which transform an AsciiDoc document to HTML5 slides animated by deck.js.

Installation

First, you should download (or git clone) the asciidoctor-backends repository to a convenient location.

git clone git://github.com/asciidoctor/asciidoctor-backends.git

Then from your working directory (that is where your AsciiDoc document resides) you must create a deck.js directory and copy there the deck.js file with its directories (extensions, themes, …​). You could also just clone the [deck.js] repository.

git clone git://github.com/imakewebthings/deck.js.git

If you are planning to split your slides you also need to copy to extensions directory the deck.split.js file which can be downloaded from GitHub.

Also if you want to use the fullscreen photo feature you must create an images directory.

Settings

There are some attributes that can be set at the top of the document which they are specific of deckjs backend.

Attribute Description

:deckjs_theme: <theme>

where you set the deck.js theme. For example: web-2.0

:deckjs_transition: <type>

where you set the kind of transition. For example: horizontal-slide

:customjs: <javascript location>

where you set a custom javascript file. It can be used as a deck.js custom configuration.

:customcss: <css location>

where you set a custom css file.

:navigation:

the presence of this attribute makes deck.js to render a back/next icons.

:status:

the presence of this attribute makes deck.js to render current slide and total number of slides.

:split:

with this attribute we are registering the deck.split.js file.

Note
You can also specify a custom stylesheet using the stylesheet attribute, which can be used to customize AsciiDoc elements like section, paragraph, images, etc…​

Examples

Let’s see some examples of deckjs backend features:

= Title Slide
Presenter Name

== Slide One

Foo

Bar

World

[canvas-image="./images/cosplay.jpg"]
== Slide Two

[role="canvas-caption", position="center-up"]
Hello World - Good Bye Cruel World

In previous snippet we are creating a slide without a title (Slide One will not be shown), but a fullscreen image as background will be embedded, and centered at top of the slide and over the image the message ``Hello World - Good Bye Cruel World''.

Some things to consider:

  • canvas-image attribute receives as parameter the location of image we want to use and always must go before section.

  • if you are planning to add a message over the image, you can do it as usually, but probably won’t be read good, using position attribute which positions text into the slide (bottom-left, top-left, bottom-right, top-right, center-up, center-down) and canvas-caption role will improve so much how text is rendered.

== Another Slide

[options="step"]
That's all.

[options="step"]
My Folks

In previous example we are creating one slide which instead of showing both paragraphs at the same time, will be presented each time you try to go to next slide.

And the same can be applied to lists, images, quotes, code:

== Yet Another Slide

[options="step"]
* A
* B
* C

In this case each bullet will appear to screen each time you try to go to next slide.

Warning
The original deckjs backend for AsciiDoc used the option name 'incremental' instead of 'step'. We’ve changed it here to save you some typing :)

Rendering

First, make sure Asciidoctor is installed:

gem install asciidoctor

Then, to render your presentation as HTML5, simply execute the command:

asciidoctor -T <backend directory> <asciidoc file>

So for the above deckjs backend you’d use

asciidoctor -T <base>/asciidoctor-backends/haml/deckjs <asciidoc file>

Stay Connected

If you need any other feature supported by deckjs to be ported to this backend, any way to make it better or you find any bug do not hesitate to open an issue.

reveal.js Backend

The reveal.js backend is a collection of slim templates which transform an AsciiDoc document to HTML5 slides animated by reveal.js.

Installation

First, you should download (or git clone) the asciidoctor-backends repository to a convenient location.

git clone git://github.com/asciidoctor/asciidoctor-backends.git

Then from your working directory (that is where your AsciiDoc document resides) you must create a reveal.js directory and copy there the reveal.js file with its directories (plugin, css, …​). You could also just clone the reveal.js repository.

git clone git://github.com/hakimel/reveal.js.git

Settings

There are some attributes that can be set at the top of the document which they are specific of revealjs backend.

Note

Default settings are based on reveal.js default settings.

Attribute Description

:revealjs_theme: <theme>

Chooses one of reveal.js' built-in themes. Default: default

:revealjs_customtheme: <file|URL>

Overrides CSS with given file or URL. Default is disabled.

:revealjs_controls: <true|false>

Display controls in the bottom right corner. Default: true

:revealjs_progress: <true|false>

Display a presentation progress bar. Default: true

:revealjs_slideNumber: <true|false>

Display the page number of the current slide. Default: false

:revealjs_history: <true|false>

Push each slide change to the browser history. Default: false

:revealjs_keyboard: <true|false>

Enable keyboard shortcuts for navigation. Default: true

:revealjs_overview: <true|false>

Enable the slide overview mode. Default: true

:revealjs_touch: <true|false>

Enables touch navigation on devices with touch input. Default: true

:revealjs_center: <true|false>

Vertical centering of slides. Default: true

:revealjs_loop: <true|false>

Loop the presentation. Default: false

:revealjs_rtl: <true|false>

Change the presentation direction to be RTL. Default: false

:revealjs_fragments: <true|false>

Turns fragments on and off globally. Default: true

:revealjs_embedded: <true|false>

Flags if the presentation is running in an embedded mode, i.e. contained within a limited portion of the screen. Default: false

:revealjs_autoSlide: <integer>

Number of milliseconds between automatically proceeding to the next slide, disabled when set to 0, this value can be overwritten by using a data-autoslide attribute on your slides. Default 0

:revealjs_autoSlideStoppable: <true|false>

Stop auto-sliding after user input. Default: true

:revealjs_mouseWheel: <true|false>

Enable slide navigation via mouse wheel. Default: false

:revealjs_hideAddressBar: <true|false>

Hides the address bar on mobile devices. Default: true

:revealjs_previewLinks: <true|false>

Opens links in an iframe preview overlay. Default: false

:revealjs_transition: <transition>

Transition style. Valid values: default/cube/page/concave/zoom/linear/fade/none

:revealjs_transitionSpeed: <speed>

Transition speed. Valid values: default/fast/slow

:revealjs_backgroundTransition: <transition>

Transition style for full page slide backgrounds. Valid values: default/none/slide/concave/convex/zoom

:revealjs_viewDistance: <integer>

Number of slides away from the current that are visible. Default: 3

:revealjs_parallaxBackgroundImage: <file|URL>

Parallax background image. Defaults to none

:revealjs_parallaxBackgroundSize: <CSS size syntax>

Parallax background size (accepts any CSS syntax). Defaults to none

If you want to build a custom theme or customize an existing one you should look at reveal.js’s documentation and use revealjs_theme attribute: https://github.com/hakimel/reveal.js/blob/master/css/theme/README.md

Examples

Let’s see some examples of revealjs backend features:

= Title Slide

== Slide One

* Foo
* Bar
* World

== Slide Two

Hello World - Good Bye Cruel World

[NOTE.speaker]
--
Actually things aren't that bad
--

In previous snippet we are creating a slide titled Slide One with bullets and another one titled Slide Two with centered text (reveal.js' default behavior) with speaker notes.

[data-background="yellow"]
== Slide Three

Is very yellow

Slide Three applies the attribute data-background to the reveal.js <section> tag. Anything accepted by CSS color formats works. Here is the upstream documentation.

== Slide Four

[%step]
* this
* is
* revealed
* gradually

Slide Four has bullets that are revealed one after the other. This is what reveal.js calls fragments. Applying the step option or role on a list ([%step] or [.step]) will do the trick. Here is upstream documentation on the topic. Note that only fade-in is supported for lists at the moment.

Rendering

First, make sure Asciidoctor is installed:

gem install asciidoctor

Then, to render your presentation as HTML5, simply execute the command:

asciidoctor -T <backend directory> <asciidoc file>

So for the above revealjs backend you’d use

asciidoctor -T <base>/asciidoctor-backends/slim/revealjs <asciidoc file>

About

Backends (i.e., templates) for Asciidoctor, a Ruby port of AsciiDoc.

http://asciidoctor.org