Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#html コマンドを紹介する #1143

Merged
merged 2 commits into from
Nov 18, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
GraphDisplay コンポーネントを紹介する
Seasawher committed Nov 18, 2024

Verified

This commit was signed with the committer’s verified signature.
sparrc Cameron Sparr
commit cb9f0045568f9bb2cdb5c618d8e1fadd9c11edb3
23 changes: 23 additions & 0 deletions LeanByExample/Reference/Diagnostic/Html.lean
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@
-/
import ProofWidgets.Component.HtmlDisplay
import ProofWidgets.Component.Recharts
import ProofWidgets.Component.GraphDisplay

-- JSX ライクな構文が使えるようにする
open scoped ProofWidgets.Jsx
@@ -54,6 +55,28 @@ open ProofWidgets
for $\\mathrm{Re} (s) > 0$.
"}/>

end --#
/- ## GraphDisplay

`<GraphDisplay />` コンポーネントを使用すると、有向グラフを表示させることができます。
-/
section --#

open ProofWidgets Jsx GraphDisplay

/-- `Edge` を作る -/
def mkEdge (st : String × String) : Edge := {source := st.1, target := st.2}

/-- 文字列として与えられたラベルから `Vertex` を作る -/
def mkVertex (id : String) : Vertex := {id := id}

-- 有向グラフを表示する
#html
<GraphDisplay
vertices={#["a", "b", "c", "d", "e"].map mkVertex}
edges={#[("a","b"), ("b","c"), ("c","d"), ("d","e"), ("e", "a")].map mkEdge}
/>

end --#
/- ## LineChart