Skip to content

Commit 8b522fb

Browse files
authored
Merge pull request #24 from chvmvd/answer
Answerコンポーネントを作成(一行空ければ、中にMarkdownを書くことも可能) resolved #19
2 parents 2ad075c + a4cc394 commit 8b522fb

File tree

4 files changed

+18
-9
lines changed

4 files changed

+18
-9
lines changed

docs/python/expressions/index.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ sidebar_position: 3
33
---
44

55
import ViewSource from "@site/src/components/ViewSource/ViewSource";
6+
import Answer from "@site/src/components/Answer";
67

78
# 式と演算子
89

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

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

46-
<details>
47-
<summary>解答</summary>
47+
<Answer>
4848
<ViewSource path="_samples/cube.ipynb" />
49-
</details>
49+
</Answer>

docs/python/get-started/index.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ sidebar_position: 2
33
---
44

55
import ViewSource from "@site/src/components/ViewSource/ViewSource";
6+
import Answer from "@site/src/components/Answer";
67

78
# はじめての Python
89

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

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

25-
<details>
26-
<summary>解答</summary>
26+
<Answer>
2727
<ViewSource path="_samples/hello-from-python.ipynb" />
28-
</details>
28+
</Answer>
2929

3030
## コメント
3131

docs/python/variables/index.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ sidebar_position: 4
33
---
44

55
import ViewSource from "@site/src/components/ViewSource/ViewSource";
6+
import Answer from "@site/src/components/Answer";
67

78
# 変数
89

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

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

38-
<details>
39-
<summary>解答</summary>
39+
<Answer>
4040
<ViewSource path="_samples/cube.ipynb" />
41-
</details>
41+
</Answer>

src/components/Answer.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import React from "react";
2+
import Details from "@theme/Details";
3+
4+
/**
5+
* 解答を書くための、コンポーネント
6+
*/
7+
export default function Answer({ children }) {
8+
return <Details summary={<summary>解答</summary>}>{children}</Details>;
9+
}

0 commit comments

Comments
 (0)