Skip to content

Commit

Permalink
v0.1.0 (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanowen authored Sep 1, 2021
1 parent 6001d3a commit 892bfb1
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 23 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mdbook-graphviz"
version = "0.0.2"
version = "0.1.0"
authors = ["Dylan Owen <[email protected]>"]
description = "mdbook preprocessor to add graphviz support"
readme = "Readme.md"
Expand Down
49 changes: 28 additions & 21 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@ cargo install mdbook-graphviz
```

Install [Graphviz](https://graphviz.gitlab.io/download/)

```
brew install graphviz
```

`book.toml`

```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
Expand All @@ -27,6 +30,7 @@ Just `dot` is supported, but any of the other graphviz tools would be easy to ad
### Mark A `dot` Code Block For Processing

#### Input

~~~markdown
```dot process
digraph {
Expand All @@ -36,35 +40,21 @@ digraph {
~~~

#### Output
~~~markdown
![](chapter_0.generated.svg)
~~~

#### Rendered
![](sample_0.generated.svg)

### Add A Name For Your Graph

#### Input
~~~markdown
```dot process Named Graph
digraph {
"processed" -> "graph"
}
```
~~~
<div><svg>...</svg></div>


#### Output
~~~markdown
![](chapter_named_graph_0.generated.svg, "Named Graph")
~~~

#### Rendered
![](sample_0.generated.svg "Named Graph")

![](sample_0.generated.svg)

### `dot` Code Blocks Without The `process` Flag Are Ignored

#### Input

~~~markdown
```dot
digraph {
Expand All @@ -74,6 +64,7 @@ digraph {
~~~

#### Output

~~~markdown
```dot
digraph {
Expand All @@ -82,9 +73,25 @@ digraph {
```
~~~

## .gitignore
## 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:

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

or

```shell
MDBOOK_preprocessor__graphviz__output_to_file="true" mdbook build
```

### .gitignore

The generated svg files are output into the book src folder for now, this `.gitignore` should cover them
This `.gitignore` should cover the generated SVG files.

```
*.generated.svg
Expand Down

0 comments on commit 892bfb1

Please sign in to comment.