### Command Line Conversion to Reveal.js Slides Source: https://context7.com/asciidoctor/asciidoctorj-reveal.js/llms.txt Illustrates how to generate Reveal.js presentations directly from the command line using the AsciidoctorJ executable JAR. This example shows downloading the `asciidoctorj-revealjs` JAR, which can then be executed with AsciiDoc files to produce HTML slides. This method is suitable for scripting and quick conversions without IDE integration. ```bash # Download the JAR (if not already available) curl -L -O https://repo1.maven.org/maven2/org/asciidoctor/asciidoctorj-revealjs/5.2.0/asciidoctorj-revealjs-5.2.0.jar ``` -------------------------------- ### Gradle Build Configuration for Reveal.js Presentations Source: https://context7.com/asciidoctor/asciidoctorj-reveal.js/llms.txt Configures a Gradle project to use Asciidoctor JVM with the Reveal.js backend. It specifies Asciidoctor and Reveal.js versions, dependencies, and registers a task to convert AsciiDoc files to Reveal.js presentations. This setup includes necessary plugins and attributes for theme, transitions, and syntax highlighting. ```gradle plugins { id 'org.asciidoctor.jvm.convert' version '3.3.2' id 'org.asciidoctor.jvm.revealjs' version '3.3.2' } repositories { mavenCentral() } asciidoctorj { version = '2.5.11' modules { diagram.version = '2.2.1' } } dependencies { asciidoctorGems 'rubygems:asciidoctor-revealjs:5.2.0' } tasks.register('generateSlides', org.asciidoctor.gradle.jvm.AsciidoctorTask) { dependsOn 'asciidoctorGemsPrepare' sourceDir file('src/docs/slides') sources { include 'presentation.adoc' } outputDir file('build/slides') backends 'revealjs' requires 'asciidoctor-revealjs' requires 'asciidoctor-diagram' attributes( 'revealjsdir': 'https://cdn.jsdelivr.net/npm/reveal.js@5.2.0', 'source-highlighter': 'highlightjs', 'revealjs_theme': 'black', 'revealjs_transition': 'slide' ) } build.dependsOn generateSlides ``` -------------------------------- ### Use Local Reveal.js Assets with Asciidoctor Source: https://context7.com/asciidoctor/asciidoctorj-reveal.js/llms.txt This Java code snippet shows how to configure Asciidoctor to use locally installed Reveal.js assets. It requires Reveal.js to be installed via npm or downloaded manually. The `revealjsdir` attribute is set to the relative or absolute path of the local Reveal.js installation, enabling offline presentation generation. The output is an HTML file ready for deployment. ```java import org.asciidoctor.Asciidoctor; import org.asciidoctor.AttributesBuilder; import org.asciidoctor.SafeMode; import java.io.File; import static org.asciidoctor.OptionsBuilder.options; public class LocalAssetsConverter { public static void main(String[] args) { // Assumes Reveal.js is installed locally: // npm install reveal.js // or downloaded and extracted to ./reveal.js/ Asciidoctor asciidoctor = Asciidoctor.Factory.create(); asciidoctor.requireLibrary("asciidoctor-revealjs"); asciidoctor.convertFile( new File("presentation.adoc"), options() .backend("revealjs") .safe(SafeMode.UNSAFE) .attributes( AttributesBuilder.attributes() // Use relative path to local Reveal.js .attribute("revealjsdir", "./node_modules/reveal.js") // Or absolute path // .attribute("revealjsdir", "/path/to/reveal.js") .attribute("source-highlighter", "highlightjs") ) .get() ); System.out.println("Presentation generated with local Reveal.js assets"); System.out.println("Deploy presentation.html with reveal.js folder for offline use"); } } ``` -------------------------------- ### Batch Convert AsciiDoc to Reveal.js Presentations Source: https://context7.com/asciidoctor/asciidoctorj-reveal.js/llms.txt This Java code snippet demonstrates how to batch convert multiple AsciiDoc files into Reveal.js presentations. It scans a specified source directory for `.adoc` files, converts each one using Asciidoctor with the Reveal.js backend, and saves the generated HTML files to an output directory. CDN-based Reveal.js assets are used in this example, but local paths can also be specified. ```java import org.asciidoctor.Asciidoctor; import org.asciidoctor.AttributesBuilder; import org.asciidoctor.SafeMode; import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.util.stream.Stream; import static org.asciidoctor.OptionsBuilder.options; public class BatchSlideGenerator { public static void main(String[] args) throws IOException { Asciidoctor asciidoctor = Asciidoctor.Factory.create(); asciidoctor.requireLibrary("asciidoctor-revealjs"); File sourceDir = new File("src/presentations"); File outputDir = new File("build/slides"); outputDir.mkdirs(); // Find all .adoc files try (Stream paths = Files.walk(sourceDir.toPath())) { paths.filter(path -> path.toString().endsWith(".adoc")) .forEach(path -> { try { File sourceFile = path.toFile(); System.out.println("Converting: " + sourceFile.getName()); asciidoctor.convertFile(sourceFile, options() .backend("revealjs") .safe(SafeMode.UNSAFE) .toDir(outputDir) .attributes( AttributesBuilder.attributes() .attribute("revealjsdir", "https://cdn.jsdelivr.net/npm/reveal.js@5.2.0") .attribute("source-highlighter", "highlightjs") ) .get() ); System.out.println("Generated: " + sourceFile.getName().replace(".adoc", ".html")); } catch (Exception e) { System.err.println("Error converting " + path + ": " + e.getMessage()); } }); } System.out.println("All presentations generated in: " + outputDir.getAbsolutePath()); } } ``` -------------------------------- ### Generate Reveal.js Slides with JBang Script Source: https://context7.com/asciidoctor/asciidoctorj-reveal.js/llms.txt This JBang script automates the process of generating reveal.js presentations. It handles downloading AsciidoctorJ and the reveal.js extension, then converts the AsciiDoc file. This method simplifies setup and build configurations. ```bash #!/usr/bin/env jbang # Install JBang if needed: curl -Ls https://sh.jbang.dev | bash -s - app setup # Generate slides with a single command jbang run asciidoctorj@asciidoctor \ -r asciidoctor-revealjs \ -b revealjs \ -a revealjsdir=https://cdn.jsdelivr.net/npm/reveal.js@5.2.0 \ -a source-highlighter=highlightjs \ presentation.adoc ``` -------------------------------- ### AsciiDoc Structure for Reveal.js Presentations Source: https://context7.com/asciidoctor/asciidoctorj-reveal.js/llms.txt An example of an AsciiDoc document structured for conversion into Reveal.js slides. It showcases how to define presentation titles, sections (horizontal slides), sub-sections (vertical slides), and embed code examples with syntax highlighting. This markup leverages Asciidoctor's features to create interactive presentations. ```asciidoc = My Technical Presentation :source-highlighter: highlightjs == Introduction Slide Welcome to the presentation! * First point * Second point * Third point == Code Example Slide Here's a Java code sample: [source,java] ---- public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, Reveal.js!"); } } ---- == Nested Slides === Sub-slide 1 Content for vertical slide === Sub-slide 2 More vertical content == Conclusion Thank you for attending! ``` -------------------------------- ### Create Reveal.js Slides using AsciidoctorJ CLI (Console) Source: https://github.com/asciidoctor/asciidoctorj-reveal.js/blob/main/README.adoc Shows the command-line interface command to generate Reveal.js slides using AsciidoctorJ. It includes specifying the classpath, backend, Reveal.js directory attribute, and the input AsciiDoc file. ```console asciidoctorj --classpath ..asciidoctor-revealjs.jar \ -b revealjs \ -a revealjsdir=https://cdn.jsdelivr.net/npm/reveal.js@5.2.0 \ document.adoc ``` -------------------------------- ### Create Reveal.js Slides with AsciidoctorJ JBang App (Console) Source: https://github.com/asciidoctor/asciidoctorj-reveal.js/blob/main/README.adoc Illustrates how to create Reveal.js slides using JBang with the Asciidoctor JBang app. This command specifies the Asciidoctor JBang app, required library, backend, Reveal.js directory, and the input AsciiDoc file. ```console jbang run asciidoctorj@asciidoctor \ -r asciidoctor-revealjs \ -b revealjs \ -a revealjsdir=https://cdn.jsdelivr.net/npm/reveal.js@5.2.0 \ document.adoc ``` -------------------------------- ### Convert Asciidoctor Presentation to Reveal.js using CLI Source: https://context7.com/asciidoctor/asciidoctorj-reveal.js/llms.txt This snippet demonstrates how to use the AsciidoctorJ command-line interface to convert an AsciiDoc file into a reveal.js presentation. It specifies the classpath for the reveal.js extension, the backend format, and required attributes for reveal.js and source highlighting. ```bash asciidoctorj --classpath asciidoctorj-revealjs-5.2.0.jar \ -b revealjs \ -a revealjsdir=https://cdn.jsdelivr.net/npm/reveal.js@5.2.0 \ -a source-highlighter=highlightjs \ presentation.adoc ``` -------------------------------- ### Programmatic Conversion to Reveal.js Slides (Java) Source: https://context7.com/asciidoctor/asciidoctorj-reveal.js/llms.txt Demonstrates how to convert an AsciiDoc file to Reveal.js HTML5 slides programmatically using AsciidoctorJ. This snippet requires the `asciidoctorj-revealjs` library and configures the Reveal.js backend with a CDN for the framework. The output is an HTML file containing the presentation slides. ```java import org.asciidoctor.Asciidoctor; import org.asciidoctor.AttributesBuilder; import org.asciidoctor.SafeMode; import java.io.File; import static org.asciidoctor.OptionsBuilder.options; public class SlideConverter { public static void main(String[] args) { // Create Asciidoctor instance Asciidoctor asciidoctor = Asciidoctor.Factory.create(); // Load the reveal.js library asciidoctor.requireLibrary("asciidoctor-revealjs"); // Convert AsciiDoc to Reveal.js slides asciidoctor.convertFile( new File("presentation.adoc"), options() .backend("revealjs") .safe(SafeMode.UNSAFE) .attributes( AttributesBuilder.attributes() .attribute("revealjsdir", "https://cdn.jsdelivr.net/npm/reveal.js@5.2.0") ) .get() ); // Output: presentation.html with Reveal.js slides System.out.println("Slides generated successfully!"); } } ``` -------------------------------- ### Maven Plugin Configuration for Reveal.js Generation Source: https://context7.com/asciidoctor/asciidoctorj-reveal.js/llms.txt Configures the Asciidoctor Maven plugin to process AsciiDoc files and generate Reveal.js presentations during the Maven build lifecycle. It specifies the `revealjs` backend, loads the `asciidoctor-revealjs` extension, and sets necessary attributes like the Reveal.js directory and source highlighter. Dependencies for AsciidoctorJ and the reveal.js extension are also defined. ```xml org.asciidoctor asciidoctor-maven-plugin 2.0.0-RC.1 generate-slides generate-resources process-asciidoc revealjs asciidoctor-revealjs https://cdn.jsdelivr.net/npm/reveal.js@5.2.0 highlightjs org.asciidoctor asciidoctorj 2.4.3 org.asciidoctor asciidoctorj-revealjs 5.2.0 ``` -------------------------------- ### Configure Asciidoctor Maven Plugin for Reveal.js Slides (XML) Source: https://github.com/asciidoctor/asciidoctorj-reveal.js/blob/main/README.adoc Provides the Maven plugin configuration to generate Reveal.js slides using the Asciidoctor Maven Plugin. It specifies the backend, required libraries, and Reveal.js directory attribute, along with necessary dependencies. ```xml org.asciidoctor asciidoctor-maven-plugin 2.0.0-RC.1 revealjs asciidoctor-revealjs https://cdn.jsdelivr.net/npm/reveal.js@5.2.0 org.asciidoctor asciidoctorj 2.4.3 org.asciidoctor asciidoctorj-revealjs {artifact-version} ``` -------------------------------- ### Create Reveal.js Slides Programmatically using AsciidoctorJ API (Java) Source: https://github.com/asciidoctor/asciidoctorj-reveal.js/blob/main/README.adoc Demonstrates how to create Reveal.js slides programmatically using the AsciidoctorJ API in Java. It requires the 'asciidoctor-revealjs' library and specifies the Reveal.js directory via attributes. ```java Asciidoctor asciidoctor = Asciidoctor.Factory.create(); asciidoctor.requireLibrary("asciidoctor-revealjs"); asciidoctor.convertFile(new File("document.adoc"), options() .backend("revealjs") .safe(SafeMode.UNSAFE) .attributes( AttributesBuilder.attributes() .attribute("revealjsdir", "https://cdn.jsdelivr.net/npm/reveal.js@5.2.0") ) .get() ); ``` -------------------------------- ### Configure Advanced Reveal.js Options with AsciidoctorJ API Source: https://context7.com/asciidoctor/asciidoctorj-reveal.js/llms.txt This Java code demonstrates advanced configuration for reveal.js presentations using the AsciidoctorJ API. It sets various attributes to customize the theme, transitions, controls, progress display, and slide numbering for the presentation. ```java import org.asciidoctor.Asciidoctor; import org.asciidoctor.AttributesBuilder; import org.asciidoctor.SafeMode; import java.io.File; import static org.asciidoctor.OptionsBuilder.options; public class AdvancedSlideConfig { public static void main(String[] args) { Asciidoctor asciidoctor = Asciidoctor.Factory.create(); asciidoctor.requireLibrary("asciidoctor-revealjs"); asciidoctor.convertFile( new File("presentation.adoc"), options() .backend("revealjs") .safe(SafeMode.UNSAFE) .toDir(new File("output")) // Specify output directory .attributes( AttributesBuilder.attributes() // Reveal.js location .attribute("revealjsdir", "https://cdn.jsdelivr.net/npm/reveal.js@5.2.0") // Theme selection .attribute("revealjs_theme", "moon") // Transition effects .attribute("revealjs_transition", "slide") // Syntax highlighting .attribute("source-highlighter", "highlightjs") // Presentation controls .attribute("revealjs_controls", "true") .attribute("revealjs_progress", "true") .attribute("revealjs_slideNumber", "true") // Embed images as data URIs .attribute("data-uri", true) ) .get() ); System.out.println("Enhanced presentation generated in output/presentation.html"); } } ``` -------------------------------- ### Create Reveal.js Slides with Diagrams using AsciidoctorJ API Source: https://context7.com/asciidoctor/asciidoctorj-reveal.js/llms.txt This Java code snippet shows how to programmatically generate reveal.js presentations using the AsciidoctorJ API. It loads both the reveal.js and diagram extensions, and configures attributes for embedding diagrams using data URIs. ```java import org.asciidoctor.Asciidoctor; import org.asciidoctor.AttributesBuilder; import org.asciidoctor.SafeMode; import java.io.File; import static org.asciidoctor.OptionsBuilder.options; public class SlidesWithDiagrams { public static void main(String[] args) { Asciidoctor asciidoctor = Asciidoctor.Factory.create(); // Load both reveal.js and diagram libraries asciidoctor.requireLibrary("asciidoctor-revealjs"); asciidoctor.requireLibrary("asciidoctor-diagram"); asciidoctor.convertFile( new File("technical-presentation.adoc"), options() .backend("revealjs") .safe(SafeMode.UNSAFE) .attributes( AttributesBuilder.attributes() .attribute("revealjsdir", "https://cdn.jsdelivr.net/npm/reveal.js@5.2.0") .attribute("data-uri", true) // Embed diagrams inline ) .get() ); } } ``` -------------------------------- ### AsciiDoc Document with PlantUML Diagrams for Reveal.js Source: https://context7.com/asciidoctor/asciidoctorj-reveal.js/llms.txt This AsciiDoc document defines a reveal.js presentation that includes PlantUML diagrams. It showcases how to define diagrams within the AsciiDoc source, specifying their format and rendering options. ```asciidoc = Architecture Overview :source-highlighter: highlightjs :data-uri: == System Architecture Here's our component diagram: [plantuml,architecture,svg] ---- @startuml package "Frontend" { [Web UI] [Mobile App] } package "Backend" { [API Gateway] [Service Layer] [Database] } [Web UI] --> [API Gateway] [Mobile App] --> [API Gateway] [API Gateway] --> [Service Layer] [Service Layer] --> [Database] @enduml ---- == Data Flow [plantuml,dataflow,svg] ---- Client -> Server: Request Server -> Database: Query Database -> Server: Results Server -> Client: Response ---- == Implementation Details Now let's look at the code... ``` -------------------------------- ### Java Test for Reveal.js Slide Generation Source: https://context7.com/asciidoctor/asciidoctorj-reveal.js/llms.txt A JUnit test class that verifies the correct generation of Reveal.js slides using Asciidoctor in Java. It converts a sample AsciiDoc file to HTML, then uses Jsoup to parse and assert the structure, including the presence of the Reveal.js container, stylesheets, and slide elements. It ensures the output adheres to the expected Reveal.js format. ```java import org.asciidoctor.Asciidoctor; import org.asciidoctor.AttributesBuilder; import org.asciidoctor.SafeMode; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.junit.Test; import java.io.File; import java.io.IOException; import java.util.List; import java.util.stream.Collectors; import static org.asciidoctor.OptionsBuilder.options; import static org.hamcrest.CoreMatchers.*; import static org.junit.Assert.*; public class SlideGenerationTest { @Test public void shouldGenerateValidRevealJsSlides() throws IOException { // Setup Asciidoctor asciidoctor = Asciidoctor.Factory.create(); File inputFile = new File("src/test/resources/sample.adoc"); File outputFile = new File("build/test-output/sample.html"); // Delete existing output if (outputFile.exists()) { outputFile.delete(); } // Convert asciidoctor.requireLibrary("asciidoctor-revealjs"); asciidoctor.convertFile(inputFile, options() .backend("revealjs") .safe(SafeMode.UNSAFE) .toDir(outputFile.getParentFile()) .attributes( AttributesBuilder.attributes() .attribute("revealjsdir", "https://cdn.jsdelivr.net/npm/reveal.js@4.5.0") ) .get() ); // Verify file created assertTrue("Output file should exist", outputFile.exists()); // Parse and validate HTML structure Document doc = Jsoup.parse(outputFile, "UTF-8"); // Check for Reveal.js container Element firstChild = doc.body().children().first(); assertThat("Should have reveal container", firstChild.className(), containsString("reveal")); // Check for stylesheets List stylesheets = doc.head().getElementsByTag("link").stream() .filter(element -> "stylesheet".equals(element.attr("rel"))) .map(element -> element.attr("href")) .collect(Collectors.toList()); assertThat("Should include Reveal.js theme CSS", stylesheets, hasItem(containsString("reveal.js"))); // Check for slides assertThat("Should contain slides", doc.select(".slides section").size(), is(not(0))); } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.