diff --git a/dargs/notebook.py b/dargs/notebook.py index 30b9708..b69b31b 100644 --- a/dargs/notebook.py +++ b/dargs/notebook.py @@ -298,7 +298,11 @@ def print_html(self, _level=0, _last_one=True): else: buff.append(r"""""") buff.append( - json.dumps(self.data, indent=2).replace("\n", f"{linebreak}{indent}") + json.dumps(self.data, indent=2) + .replace(" ", " ") + .replace( + "\n", f"""{linebreak}{indent}""" + ) ) if not _last_one: buff.append(",") diff --git a/dargs/sphinx.py b/dargs/sphinx.py index 5fe46e2..4e61770 100644 --- a/dargs/sphinx.py +++ b/dargs/sphinx.py @@ -171,6 +171,7 @@ def _test_argument() -> Argument: doc=doc_test, sub_fields=[ Argument("test_argument", dtype=str, doc=doc_test, default="test"), + Argument("test_list", dtype=List[int], optional=True), ], sub_variants=[ Variant( diff --git a/docs/nb.ipynb b/docs/nb.ipynb index 1793515..4b3d844 100644 --- a/docs/nb.ipynb +++ b/docs/nb.ipynb @@ -21,6 +21,11 @@ "jstr = \"\"\"\n", "{\n", " \"test_argument\": \"test1\",\n", + " \"test_list\": [\n", + " 1,\n", + " 2,\n", + " 3\n", + " ],\n", " \"test_variant\": \"test_variant_argument\",\n", " \"test_repeat\": [\n", " {\"test_repeat_item\": false},\n",