Skip to content

Instantly share code, notes, and snippets.

@bruskiza
Last active April 24, 2017 16:17
Show Gist options
  • Save bruskiza/1fded211d4eabd9ed4a4399dc2bafc72 to your computer and use it in GitHub Desktop.
Save bruskiza/1fded211d4eabd9ed4a4399dc2bafc72 to your computer and use it in GitHub Desktop.

AsciiDoctor Demo with Mermaid

1. Introduction

AsciiDoctor has more things over AsciiDoc plain.

  graph LR
    asciidoc -- is enhanced by --> asciidoctor

2. Example Sequence Diagram

  sequenceDiagram
    participant Alice
    participant Bob
    Alice->John: Hello John, how are you?
    loop Healthcheck
        John->John: Fight against hypochondria
    end
    Note right of John: Rational thoughts <br/>prevail...
    John-->Alice: Great!
    John->Bob: How about you?
    Bob-->John: Jolly good!

3. Processing

I run this in a Guard file using ruby:

require 'asciidoctor'
require 'erb'

guard 'shell' do
  watch(/^*.asc$/) {|m|
    p "Converting '#{m[0]}'..."
    # Asciidoctor.convert_file(m[0], :in_place => true)
    #`asciidoctor-pdf -r asciidoctor-diagram -a stylesheet="./stylesheet.css" #{m[0]}`
    `asciidoctor -r asciidoctor-diagram -a stylesheet="./stylesheet.css" #{m[0]}`

  }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment