edwh-editorjs 2.0.0b2__tar.gz → 2.0.0b3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {edwh_editorjs-2.0.0b2 → edwh_editorjs-2.0.0b3}/CHANGELOG.md +6 -0
- {edwh_editorjs-2.0.0b2 → edwh_editorjs-2.0.0b3}/PKG-INFO +1 -1
- edwh_editorjs-2.0.0b3/editorjs/__about__.py +1 -0
- {edwh_editorjs-2.0.0b2 → edwh_editorjs-2.0.0b3}/editorjs/blocks.py +1 -1
- {edwh_editorjs-2.0.0b2 → edwh_editorjs-2.0.0b3}/editorjs/core.py +10 -3
- {edwh_editorjs-2.0.0b2 → edwh_editorjs-2.0.0b3}/tests/test_core.py +2 -2
- edwh_editorjs-2.0.0b2/editorjs/__about__.py +0 -1
- {edwh_editorjs-2.0.0b2 → edwh_editorjs-2.0.0b3}/.github/workflows/build_documentation.yml +0 -0
- {edwh_editorjs-2.0.0b2 → edwh_editorjs-2.0.0b3}/.github/workflows/publish_to_pypi.yml +0 -0
- {edwh_editorjs-2.0.0b2 → edwh_editorjs-2.0.0b3}/.github/workflows/pytest.yml +0 -0
- {edwh_editorjs-2.0.0b2 → edwh_editorjs-2.0.0b3}/.gitignore +0 -0
- {edwh_editorjs-2.0.0b2 → edwh_editorjs-2.0.0b3}/LICENSE +0 -0
- {edwh_editorjs-2.0.0b2 → edwh_editorjs-2.0.0b3}/README.md +0 -0
- {edwh_editorjs-2.0.0b2 → edwh_editorjs-2.0.0b3}/editorjs/__init__.py +0 -0
- {edwh_editorjs-2.0.0b2 → edwh_editorjs-2.0.0b3}/editorjs/exceptions.py +0 -0
- {edwh_editorjs-2.0.0b2 → edwh_editorjs-2.0.0b3}/editorjs/helpers.py +0 -0
- {edwh_editorjs-2.0.0b2 → edwh_editorjs-2.0.0b3}/editorjs/types.py +0 -0
- {edwh_editorjs-2.0.0b2 → edwh_editorjs-2.0.0b3}/pyproject.toml +0 -0
- {edwh_editorjs-2.0.0b2 → edwh_editorjs-2.0.0b3}/tests/__init__.py +0 -0
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
<!--next-version-placeholder-->
|
|
4
4
|
|
|
5
|
+
## v2.0.0-beta.3 (2024-11-06)
|
|
6
|
+
|
|
7
|
+
### Fix
|
|
8
|
+
|
|
9
|
+
* Various fixes with nested lists ([`52a7773`](https://github.com/educationwarehouse/edwh-editorjs/commit/52a7773470dce3eee6a2d17d46b594551ed043a5))
|
|
10
|
+
|
|
5
11
|
## v2.0.0-beta.2 (2024-11-06)
|
|
6
12
|
|
|
7
13
|
### Feature
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: edwh-editorjs
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.0b3
|
|
4
4
|
Summary: EditorJS.py
|
|
5
5
|
Project-URL: Homepage, https://github.com/educationwarehouse/edwh-EditorJS
|
|
6
6
|
Author-email: SKevo <skevo.cw@gmail.com>, Robin van der Noord <robin.vdn@educationwarehouse.nl>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "2.0.0-beta.3"
|
|
@@ -171,7 +171,7 @@ class ListBlock(EditorJSBlock):
|
|
|
171
171
|
markdown_items = []
|
|
172
172
|
for index, item in enumerate(subitems):
|
|
173
173
|
prefix = f"{index + 1}." if style == "ordered" else "-"
|
|
174
|
-
line = f"{'
|
|
174
|
+
line = f"{'\t' * depth}{prefix} {item['content']}"
|
|
175
175
|
markdown_items.append(line)
|
|
176
176
|
|
|
177
177
|
# Recurse if there are nested items
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import json
|
|
2
|
+
import textwrap
|
|
2
3
|
import typing as t
|
|
3
4
|
|
|
4
5
|
import markdown2
|
|
@@ -16,9 +17,8 @@ EDITORJS_VERSION = "2.30.6"
|
|
|
16
17
|
class EditorJS:
|
|
17
18
|
# internal representation is mdast, because we can convert to other types
|
|
18
19
|
_mdast: MDRootNode
|
|
19
|
-
_md = markdown2.Markdown(extras=["task_list"]) # todo: striketrough, table, ...
|
|
20
20
|
|
|
21
|
-
def __init__(self, _mdast: str | dict):
|
|
21
|
+
def __init__(self, _mdast: str | dict, extras: list = ("task_list", "fenced-code-blocks")):
|
|
22
22
|
if not isinstance(_mdast, str | dict):
|
|
23
23
|
raise TypeError("Only `str` or `dict` is supported!")
|
|
24
24
|
|
|
@@ -26,6 +26,8 @@ class EditorJS:
|
|
|
26
26
|
MDRootNode, json.loads(_mdast) if isinstance(_mdast, str) else _mdast
|
|
27
27
|
)
|
|
28
28
|
|
|
29
|
+
self._md = markdown2.Markdown(extras=extras) # todo: striketrough, table, ?
|
|
30
|
+
|
|
29
31
|
@classmethod
|
|
30
32
|
def from_json(cls, data: str | dict) -> Self:
|
|
31
33
|
"""
|
|
@@ -48,6 +50,7 @@ class EditorJS:
|
|
|
48
50
|
"""
|
|
49
51
|
Load from markdown string
|
|
50
52
|
"""
|
|
53
|
+
|
|
51
54
|
return cls(mdast.md_to_json(data))
|
|
52
55
|
|
|
53
56
|
@classmethod
|
|
@@ -78,7 +81,11 @@ class EditorJS:
|
|
|
78
81
|
"""
|
|
79
82
|
Export Markdown string
|
|
80
83
|
"""
|
|
81
|
-
|
|
84
|
+
md = mdast.json_to_md(self.to_mdast())
|
|
85
|
+
# idk why this happens:
|
|
86
|
+
md = md.replace(r"\[ ]", "[ ]")
|
|
87
|
+
md = md.replace(r"\[x]", "[x]")
|
|
88
|
+
return md
|
|
82
89
|
|
|
83
90
|
def to_mdast(self) -> str:
|
|
84
91
|
"""
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "2.0.0-beta.2"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|