Skip to content

Commit

Permalink
Merge pull request #24 from chvmvd/answer
Browse files Browse the repository at this point in the history
Answerコンポーネントを作成(一行空ければ、中にMarkdownを書くことも可能) resolved #19
  • Loading branch information
chvmvd authored Oct 15, 2022
2 parents 2ad075c + a4cc394 commit 8b522fb
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
6 changes: 3 additions & 3 deletions docs/python/expressions/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ sidebar_position: 3
---

import ViewSource from "@site/src/components/ViewSource/ViewSource";
import Answer from "@site/src/components/Answer";

# 式と演算子

Expand Down Expand Up @@ -43,7 +44,6 @@ Python では様々な計算ができます。

球の体積( $\frac{4}{3}\pi r^3$ )を求めてみましょう。$\pi=3.14, r=2$ とします。

<details>
<summary>解答</summary>
<Answer>
<ViewSource path="_samples/cube.ipynb" />
</details>
</Answer>
6 changes: 3 additions & 3 deletions docs/python/get-started/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ sidebar_position: 2
---

import ViewSource from "@site/src/components/ViewSource/ViewSource";
import Answer from "@site/src/components/Answer";

# はじめての Python

Expand All @@ -22,10 +23,9 @@ import ViewSource from "@site/src/components/ViewSource/ViewSource";

`Hello from Python!` と出力するようなプログラムを書いてみましょう。

<details>
<summary>解答</summary>
<Answer>
<ViewSource path="_samples/hello-from-python.ipynb" />
</details>
</Answer>

## コメント

Expand Down
6 changes: 3 additions & 3 deletions docs/python/variables/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ sidebar_position: 4
---

import ViewSource from "@site/src/components/ViewSource/ViewSource";
import Answer from "@site/src/components/Answer";

# 変数

Expand Down Expand Up @@ -35,7 +36,6 @@ Python では定数は使えないようです。慣習的に定数は大文字

[式と演算子の項](/docs/python/expressions/#問題)の問題を変数を使って解いてみましょう。

<details>
<summary>解答</summary>
<Answer>
<ViewSource path="_samples/cube.ipynb" />
</details>
</Answer>
9 changes: 9 additions & 0 deletions src/components/Answer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from "react";
import Details from "@theme/Details";

/**
* 解答を書くための、コンポーネント
*/
export default function Answer({ children }) {
return <Details summary={<summary>解答</summary>}>{children}</Details>;
}

0 comments on commit 8b522fb

Please sign in to comment.