-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmix.exs
89 lines (81 loc) · 2.24 KB
/
mix.exs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
defmodule DG.MixProject do
use Mix.Project
@source_url "https://github.com/princemaple/dg"
@version "0.4.1"
def project do
[
app: :dg,
version: @version,
elixir: "~> 1.12",
start_permanent: Mix.env() == :prod,
deps: deps(),
docs: docs(),
package: package(),
preferred_cli_env: [
docs: :docs,
"hex.publish": :docs
]
]
end
def application do
[extra_applications: [:logger]]
end
defp deps do
[
{:abnf_parsec, "~> 1.2", runtime: false},
{:libgraph, ">= 0.0.0", optional: true},
{:ex_doc, ">= 0.0.0", only: :docs}
]
end
defp package do
[
description: "Elixir wrapper of `:digraph` with a pinch of protocols and sigils",
licenses: ["MIT"],
maintainers: ["Po Chen"],
links: %{
Changelog: "https://hexdocs.pm/dg/changelog.html",
GitHub: @source_url
}
]
end
defp docs do
[
extras: [
"CHANGELOG.md": [],
LICENSE: [title: "License"],
"README.md": [title: "Overview"]
],
assets: "assets",
main: "readme",
canonical: "http://hexdocs.pm/dg",
homepage_url: @source_url,
source_url: @source_url,
source_ref: "v#{@version}",
before_closing_body_tag: &before_closing_body_tag/1
]
end
defp before_closing_body_tag(:html) do
"""
<script src="https://unpkg.com/[email protected]/dist/mermaid.min.js"></script>
<script>
document.addEventListener("DOMContentLoaded", function () {
mermaid.initialize({ startOnLoad: false });
let id = 0;
for (const codeEl of document.querySelectorAll("pre code.mermaid")) {
const preEl = codeEl.parentElement;
const graphDefinition = codeEl.textContent;
const graphEl = document.createElement("div");
const graphId = "mermaid-graph-" + id++;
mermaid.render(graphId, graphDefinition, function (svgSource, bindListeners) {
graphEl.innerHTML = svgSource;
bindListeners && bindListeners(graphEl);
preEl.insertAdjacentElement("afterend", graphEl);
preEl.remove();
});
}
});
</script>
"""
end
defp before_closing_body_tag(_), do: ""
end