Asciidoctor render_file missing CSS

asciidoctor, css, ruby, ruby-2.0

Solution

To embed the stylesheet, you must have to render the file in the "unsafe" mode:

require 'asciidoctor'
Asciidoctor.render_file('mysample.adoc', :in_place => true, :safe => 'unsafe')

Problem

Running AsciiDoctor from the CLI creates a HTML document with an embedded stylesheet: ``` $ asciidoctor mysample.adoc .... <title>My First Experience with the Dangers of Documentation</title> <style> /* Asciidoctor default stylesheet | MIT License | http://asciidoctor.org */ article, aside, details, figcaption, figure, footer, header, hgroup, main, nav, section, summary { display: block; } ... ``` However, running Asciidoctor in a Ruby file does not: ``` r.rb: #!/usr/bin/env ruby require 'asciidoctor' Asciidoctor.render_file('mysample.adoc', :in_place => true) $ ./r.rb ... <title>My First Experience with the Dangers of Documentation</title> <link rel="stylesheet" href="./asciidoctor.css"> ... ``` The documentation doesn't indicate that there should be any difference. What am I missing? Details: - Asciidoctor 0.1.4 - ruby 2.0.0p247

Original source