GithubHelp home page GithubHelp logo

chanibal / asciidoctor-diagram Goto Github PK

View Code? Open in Web Editor NEW

This project forked from asciidoctor/asciidoctor-diagram

0.0 1.0 0.0 11.73 MB

:left_right_arrow: Asciidoctor diagram extension, with support for PlantUML, Graphviz and ditaa.

Home Page: http://asciidoctor.org

License: MIT License

Ruby 100.00%

asciidoctor-diagram's Introduction

Asciidoctor Diagram

Asciidoctor Diagram is a set of extensions for Asciidoctor, the Ruby-based AsciiDoc processor. These extensions allow you to embed plain text diagrams inside your AsciiDoc documents using one of the following syntaxes:

The extension takes care of running the diagram processor to generate the images from the input text and insert them into the rendered document.

This gem was inspired by the AsciiDoc PlantUML filter for AsciiDoc Python.

Status

Linux Build Status

Windows Build Status

Installation

Add this line to your application’s Gemfile:

gem 'asciidoctor-diagram'

And then execute:

$ bundle

Or install it yourself as:

$ gem install asciidoctor-diagram

Additional Requirements

Certain diagram types require other tools to be installed seperately.

  • PlantUML and Graphviz: the Graphviz dot tool.

  • Shaape: the Shaape Python package

  • Block/Seq/Act/Nw diag: the block/seq/act/nw diag Python packages

Usage

Enable the extensions

The diagram extensions consist of a set of block processors for Asciidoctor. In order to use extensions you should need to invoke Asciidoctor via the Ruby API. In your script you can then either require one or more of the following files:

  1. asciidoctor-diagram: to enable all the diagramming extensions

  2. asciidoctor-diagram/blockdiag: to enable the block/act/seq/nw diag extension

  3. asciidoctor-diagram/ditaa: to enable the ditaa extension

  4. asciidoctor-diagram/graphviz: to enable the graphviz extension

  5. asciidoctor-diagram/plantuml: to enable the plantuml extension

  6. asciidoctor-diagram/shaape: to enable the shaape extension

Requiring one or more of these files will automatically register the extensions for all processed documents. If you need more fine grained control over when the extensions are enabled or not, asciidoctor-diagram/ditaa/extension, asciidoctor-diagram/graphviz/extension and asciidoctor-diagram/plantuml/extension can be used instead. These load the extensions themselves but do not register them. You should then register the extensions yourself at the appropriate time using the Asciidoctor::Extensions API.

Using the extensions

Once the extensions are enabled the following block types becomes available for your documents:

  • blockdiag, actdiag, seqdiag, nwdiag, rackdiag and packetdiag

  • ditaa

  • graphviz

  • plantuml

  • shaape

Detailed descriptions of the supported syntax inside these blocks is available on the PlantUML, Graphviz and ditaa websites.

At this point you can start adding diagrams to your application, like the following example:

["plantuml", "asciidoctor-diagram-classes", "png"]
---------------------------------------------------------------------
class BlockProcessor
class DiagramBlock
class DitaaBlock
class PlantUmlBlock

BlockProcessor <|-- DiagramBlock
DiagramBlock <|-- DitaaBlock
DiagramBlock <|-- PlantUmlBlock
---------------------------------------------------------------------

The diagram blocks support the following attributes:

  1. target (or 2nd position): the basename of the file to generate. If not specified an auto-generated name will be used.

  2. format (or 3rd position): the output format. PlantUML blocks support png, svg and txt. Graphviz, Shaape and BlockDiag support png and svg. Ditaa only supports png.

Once you have all of this in place and your original AsciiDoc file contains a diagram block, it’s time to build it into an HTML file with Asciidoctor Diagram magic! When executing Asciidoctor, you must reference the Adciidoctor Diagram library, otherwise your diagam blocks won’t be recognized as such. When executing Asciidoctor from the command line, do it using the -r parameter to reference this external library:

$ asciidoctor -r asciidoctor-diagram doc.adoc

Contributing

  1. Fork it

  2. Create your feature branch (git checkout -b my-new-feature)

  3. Commit your changes (git commit -am 'Add some feature')

  4. Push to the branch (git push origin my-new-feature)

  5. Create new Pull Request

asciidoctor-diagram's People

Contributors

chanibal avatar j-manu avatar mojavelinux avatar nearnshaw avatar neher avatar pepijnve avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.