# Memoforest Tool Manual

## JSON 形式

- トップレベルはオブジェクト
- `type` は `"annotator-qa-export"`
- `version` は `3`
- 実データは `projects` 配列に入れる

## `project`

- 各 `project` はオブジェクト
### `project` のフィールド

- `title`: 文字列
- `nodes`: `node` の配列

## `node`

- 各 `node` はオブジェクト
- `id`, `topic`, `parentId`, `sections` を持つ
- 最上位の `node` は `parentId: null`
- 子 `node` は `parentId` に親 `node` の `id` を入れる
- 同じ親を持つ `node` の順序は `nodes` 配列の順序で決まる

### `node` のフィールド

- `id`: 文字列
- `topic`: 文字列
- `parentId`: 文字列または `null`
- `sections`: `section` の配列

## `section`

- 各 `section` はオブジェクト
- `id`, `title`, `content` を持つ

### `section` のフィールド

- `id`: 文字列
- `title`: 文字列
- `content`: 文字列

## 本文記法

- `content` は Markdown
- インライン数式は `$...$`
- 別行数式は `\[ ... \]`
- JSON 内の `content` は JSON 文字列なので、バックスラッシュで始まる記法は `\\` として書く
- 例: `\\alpha`, `\\frac{a}{b}`, `\\sqrt{x}`, `\\text{...}`, `\\to`, `\\[ ... \\]`, `\\( ... \\)`

## 最小例

```json
{
  "type": "annotator-qa-export",
  "version": 3,
  "projects": [
    {
      "title": "Sample",
      "nodes": [
        {
          "id": "n-definition",
          "topic": "定義",
          "parentId": null,
          "sections": [
            {
              "id": "s-definition-1",
              "title": "概要",
              "content": "ここに本文を書きます。"
            }
          ]
        }
      ]
    }
  ]
}
```

## 推奨する構造

- 一画面に収まるのは子ノードまでのため、深さは「ルートノード → 子ノード」の2階層に収めることを推奨する
- 複数の観点やトピックを扱う場合は、それぞれを独立したルートノード（`parentId: null`）として並べると見やすい

## 子ノードを持つ例

```json
{
  "type": "annotator-qa-export",
  "version": 3,
  "projects": [
    {
      "title": "Tree Sample",
      "nodes": [
        {
          "id": "n-topic-a",
          "topic": "トピック A",
          "parentId": null,
          "sections": [
            {
              "id": "n-topic-a-s1",
              "title": "",
              "content": "トピック A の概要。"
            }
          ]
        },
        {
          "id": "n-topic-a-detail",
          "topic": "詳細",
          "parentId": "n-topic-a",
          "sections": [
            {
              "id": "n-topic-a-detail-s1",
              "title": "",
              "content": "この node は `n-topic-a` の子です。"
            }
          ]
        },
        {
          "id": "n-topic-b",
          "topic": "トピック B",
          "parentId": null,
          "sections": [
            {
              "id": "n-topic-b-s1",
              "title": "",
              "content": "トピック B の概要。"
            }
          ]
        }
      ]
    }
  ]
}
```
