Follow these steps to setup AsciiDoc in a Middleman 3 site.
Note
|
Middleman 4 will require the use of the middleman-asciidoc gem.
|
-
Install middleman
$ gem install middleman
-
Create a new project
$ middleman init sample
-
Add Asciidoctor (
asciidoctor
) to the GemfileGemfilesource 'https://rubygems.org' gem 'middleman', '~> 3.3.7' # Live-reloading plugin gem 'middleman-livereload', '~> 3.4.2' # For faster file watcher updates on Windows: gem 'wdm', '~> 0.1.0', :platforms => [:mswin, :mingw] # Windows does not come with time zone data gem 'tzinfo-data', :platforms => [:mswin, :mingw] # Activate support for AsciiDoc gem 'asciidoctor', '~> 1.5.2'
-
Configure Asciidoctor
config.rbset :asciidoc_attributes, %w(source-highlighter=coderay coderay-css=style) ...
-
Create an AsciiDoc page
source/sample.adoc= Rendered by Asciidoctor Author Name :page-layout: layout (1) Learn more about Asciidoctor at http://asciidoctor.org.
-
Optionally specify the page layout using the
page-layout
attribute
-
-
Run the preview server
$ middleman
-
Visit the AsciiDoc page at http://localhost:4567/sample.html
There you have it! You can now write any page in AsciiDoc!
You can also add this to your
config.rb
for using an:asciidoc
filter for inline AsciiDoc in HAML:(It's basically like HAML's Markdown filters, but using AsciiDoc instead.)