Giter Site home page Giter Site logo

mdbook-graphviz's Introduction

mdBook Graphviz

crates.io LICENSE

Install

cargo install mdbook-graphviz

Install Graphviz

brew install graphviz

book.toml

[preprocessor.graphviz]
command = "mdbook-graphviz"
output-to-file = false # defaults to false, change to true to create SVG files instead of rendering them inline

Usage

Just dot is supported, but any of the other graphviz tools would be easy to add.

Mark A dot Code Block For Processing

Input

```dot process
digraph {
    "processed" -> "graph"
}
```

Output

<div><svg>...</svg></div>

Rendered

dot Code Blocks Without The process Flag Are Ignored

Input

```dot
digraph {
    "processed" -> "graph"
}
```

Output

```dot
digraph {
    "processed" -> "graph"
}
```

Output To File

The default is to embed the SVG as HTML in the Markdown, however if this causes problems or if the actual files are needed you can disable this via the output-to-file flag:

[preprocessor.graphviz]
output-to-file = true

or

MDBOOK_preprocessor__graphviz__output_to_file="true" mdbook build

.gitignore

This .gitignore should cover the generated SVG files.

*.generated.svg

Embedding dot files

Sometimes you don't want to write dot code, but instead include it from a file:

```dot
{{#include path/to/file.dot}}
```

In this case, you might want to modify the order of preprocessors, so the include directives get resolved before it's passed to Graphviz.

In that case, make sure your [preprocessor.graphviz] section in the config orders itself after links:

[preprocessor.graphviz]
after = ["links"]

More information about preprocessors and ordering can be found here.

mdbook-graphviz's People

Contributors

renovate[bot] avatar dylanowen avatar dependabot[bot] avatar christianmoesl avatar felixhuettner avatar azriel91 avatar flokli avatar cypher1 avatar tgockel avatar naeu 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.