magjac
(Magnus Jacobsson)
2020 年 5 月 27 日午後 9:57
1
The D3 Graphviz Theme Component allows you to add animated Graphviz graphs to your post using the DOT language. Based on d3-graphviz .
Repository: GitHub - magjac/discourse-d3-graphviz: Discourse theme component for rendering animated Graphviz graphs using DOT source code
Installation
See How do I install a Theme or Theme Component?
Usage
Static graphs
This is just a brief introduction. You may want to read the detailed Render Graphviz graphs directly in your posts - Announcements - Graphviz which shows the theme component in action or join the Graphviz fourm where you can use it yourself.
To render a graph inline in your post, wrap the graph definition in dot tags like this:
[dot] digraph {a -> b} [/dot]
The block form is also supported:
[dot]
digraph {
a -> b
}
[/dot]
Animated transitions between graphs
An animated transition between multiple graphs is shown when more than one graph is added to the same paragraph of a post and there is only whitespace between them:
[dot] digraph {bgcolor=lightblue a -> b} [/dot]
[dot] digraph {bgcolor=lightblue a -> b; a -> c} [/dot]
[dot] digraph {bgcolor=lightblue a -> b; a -> c; b -> c} [/dot]
or
[dot]
digraph {
a -> b
}
[/dot]
[dot]
digraph {
a -> b
a -> c
}
[/dot]
[dot]
digraph {
a -> b
a -> c
b -> c
}
[/dot]
Paragraphs are separated by blank lines, so this will generate three separate graphs:
[dot] digraph {bgcolor=lightblue a -> b} [/dot]
[dot] digraph {bgcolor=lightblue a -> b; a -> c} [/dot]
[dot] digraph {bgcolor=lightblue a -> b; a -> c; b -> c} [/dot]
Options
The graphs and the animated transitions are highly customizable by options that you can add to the dot tag. See Render Graphviz graphs directly in your posts - Announcements - Graphviz .
「いいね!」 8
pfaffman
(Jay Pfaffman)
2021 年 4 月 18 日午後 6:47
2
A client yesterday reported that all of the content of their posts was missing. I disabled this theme to resolve the problem.
I think this should be moved to #theme:broken-theme , but wondered if anyone else has had trouble.
「いいね!」 3
sam
(Sam Saffron)
2021 年 4 月 19 日午前 1:24
3
Yes there are a bunch of edge cases with this approach, recommend anyone wanting graphviz use:
「いいね!」 3
magjac
(Magnus Jacobsson)
2024 年 1 月 14 日午後 3:57
4
@pfaffman この投稿に気づかず、すぐに対応できなかったことをお詫びします。通知を誤ってオフにしてしまったようです。以前、この問題に自分で気づいたのですが、その時は対応する時間がなく、投稿したことも覚えておらず、他の誰かが使用していることも知りませんでした。
d3-graphvizテーマコンポーネントが再び動作するようになったことをお知らせできることを嬉しく思います。https://forum.graphviz.org/t/render-graphviz-graphs-directly-in-your-posts/125で実際に動作している様子をご覧いただけます。
@sam brokenタグを削除していただけますか?
「いいね!」 4
fbpbdmin
(deepblue)
2024 年 4 月 27 日午後 11:23
5
このコンポーネントをインストールしました。(Discourse 3.2.1)
上記の例を新しい投稿にコピーしましたが、グラフとしてレンダリングされません。
これが現在機能するかどうか、誰か確認していただけますか?よろしくお願いします…
これは「コンテンツセキュリティポリシー」が原因です…
「コンテンツセキュリティポリシー スクリプト src」設定に何を追加すれば機能するか分かりません… 誰か助けていただけますか?よろしくお願いします…
プラグインを試しましたか?より安定しているようです。
Summary
Discourse Graphviz provides the ability to add graphs to posts using the DOT language.
Install Guide
This plugin is bundled with Discourse core. There is no need to install the plugin separately.
Features
This plugin uses the Viz.js library to render graphs.
To embed a graph use [graphviz] [/graphviz] bbcode. Optionally you can define layout engine attributes: [graphviz engine=neato]. If engine is not defined, it defaults to the dot engine…
おそらく、これらのリンクを許可する必要があります。
「いいね!」 2
fbpbdmin
(deepblue)
2024 年 4 月 28 日午前 12:19
7
@Arkshine ありがとうございます。
ホストインスタンスには、プラン用のGraphvizプラグインが含まれていません
「コンテンツセキュリティポリシーのスクリプトソース」設定にこれらの3つのファイルを追加しようとしましたが、うまくいきませんでした…
「いいね!」 2
こちらのコンポーネントをお試しいただけますでしょうか。
Contribute to discourse/discourse-graphviz-theme-component development by creating an account on GitHub.
これにより、サードパーティ製ライブラリを統合する際のCSP問題回避策として、より良い方法となります。
注意 : ラッパーが異なります。BBCodeではありません。
「いいね!」 2
fbpbdmin
(deepblue)
2024 年 4 月 28 日午前 2:16
9
ありがとう、@Arkshine
うまくいきました!
「いいね!」 2
magjac
(Magnus Jacobsson)
2024 年 4 月 29 日午後 8:24
10
静的なグラフで十分な場合は、discourse-graphviz-theme-component で十分ですが、グラフ間のアニメーション遷移を使用し、グラフレンダリングのさまざまな側面を制御したい場合は、D3 Graphviz Theme Component を試すことをお勧めします。実際に動作している様子は、以下で確認できます。
Render graphs directly in your posts with [dot]your DOT source here[/dot]. When you are posting something here at the forum and want to show a graph that is generated by some DOT source code; wouldn’t it be great if you could just generate the...
Reading time: 9 mins 🕑
Likes: 14 ❤
ホワイトリスト登録は不要です。これが私たちのセットアップです。
「いいね!」 1
fbpbdmin
(deepblue)
2024 年 4 月 30 日午前 12:14
11
ねえ、@magjac
アニメーションのためにD3のものを使ってみようと思うのですが、上記で報告したコンテンツセキュリティポリシーの問題が発生しました。動作させるために何か設定を変更する必要がありますか?
私たちのインスタンスは現在3.2.1です。よろしくお願いします…
I installed this component, (Discourse 3.2.1)
copied the example above into a new post, it does not render as a graph,
could someone confirm, if this one works now, thanks…
this is caused by “Content Security Policy” thing…
not sure what to add in “content security policy script src” setting to make it work… could someone help, thanks…
deepblue:
動作するように設定を変更します
残念ながら、彼は厳密な動的CSPを使用する新しい設定を使用していますが、これは3.2.1にはありません。
「いいね!」 1