edwh-editorjs 2.5.0a1__tar.gz → 2.5.0a3__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.5.0a1 → edwh_editorjs-2.5.0a3}/PKG-INFO +2 -1
- edwh_editorjs-2.5.0a3/editorjs/__about__.py +1 -0
- {edwh_editorjs-2.5.0a1 → edwh_editorjs-2.5.0a3}/editorjs/blocks.py +6 -2
- {edwh_editorjs-2.5.0a1 → edwh_editorjs-2.5.0a3}/pyproject.toml +3 -2
- {edwh_editorjs-2.5.0a1 → edwh_editorjs-2.5.0a3}/tests/test_core.py +9 -4
- edwh_editorjs-2.5.0a1/editorjs/__about__.py +0 -1
- {edwh_editorjs-2.5.0a1 → edwh_editorjs-2.5.0a3}/.gitignore +0 -0
- {edwh_editorjs-2.5.0a1 → edwh_editorjs-2.5.0a3}/CHANGELOG.md +0 -0
- {edwh_editorjs-2.5.0a1 → edwh_editorjs-2.5.0a3}/README.md +0 -0
- {edwh_editorjs-2.5.0a1 → edwh_editorjs-2.5.0a3}/editorjs/__init__.py +0 -0
- {edwh_editorjs-2.5.0a1 → edwh_editorjs-2.5.0a3}/editorjs/core.py +0 -0
- {edwh_editorjs-2.5.0a1 → edwh_editorjs-2.5.0a3}/editorjs/exceptions.py +0 -0
- {edwh_editorjs-2.5.0a1 → edwh_editorjs-2.5.0a3}/editorjs/helpers.py +0 -0
- {edwh_editorjs-2.5.0a1 → edwh_editorjs-2.5.0a3}/editorjs/types.py +0 -0
- {edwh_editorjs-2.5.0a1 → edwh_editorjs-2.5.0a3}/tests/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: edwh-editorjs
|
|
3
|
-
Version: 2.5.
|
|
3
|
+
Version: 2.5.0a3
|
|
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>
|
|
@@ -13,6 +13,7 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.12
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.13
|
|
15
15
|
Requires-Python: >=3.10
|
|
16
|
+
Requires-Dist: html2markdown
|
|
16
17
|
Requires-Dist: humanize
|
|
17
18
|
Requires-Dist: markdown2
|
|
18
19
|
Requires-Dist: mdast
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "2.5.0a3"
|
|
@@ -13,7 +13,7 @@ import markdown2
|
|
|
13
13
|
|
|
14
14
|
from .exceptions import TODO, Unreachable
|
|
15
15
|
from .types import EditorChildData, MDChildNode
|
|
16
|
-
|
|
16
|
+
import html2markdown
|
|
17
17
|
|
|
18
18
|
class EditorJSBlock(abc.ABC):
|
|
19
19
|
@classmethod
|
|
@@ -173,6 +173,9 @@ class ParagraphBlock(EditorJSBlock):
|
|
|
173
173
|
}
|
|
174
174
|
)
|
|
175
175
|
|
|
176
|
+
# deal with bold etc:
|
|
177
|
+
text = html2markdown.convert(text)
|
|
178
|
+
|
|
176
179
|
return f"{text}\n\n"
|
|
177
180
|
|
|
178
181
|
@classmethod
|
|
@@ -245,7 +248,8 @@ class ParagraphBlock(EditorJSBlock):
|
|
|
245
248
|
|
|
246
249
|
@classmethod
|
|
247
250
|
def to_text(cls, node: MDChildNode) -> str:
|
|
248
|
-
return
|
|
251
|
+
return process_styled_content(node)
|
|
252
|
+
# return default_to_text(node)
|
|
249
253
|
|
|
250
254
|
|
|
251
255
|
@block("list")
|
|
@@ -259,9 +259,6 @@ def test_image_options():
|
|
|
259
259
|
|
|
260
260
|
|
|
261
261
|
def test_figcaption():
|
|
262
|
-
# md = """"""
|
|
263
|
-
# e = EditorJS.from_markdown(md)
|
|
264
|
-
|
|
265
262
|
js = """{"time":1742471258492,"blocks":[{"id":"ZoA3rbc05C","type":"image","data":{"caption":"Party Time!","withBorder":false,"withBackground":false,"stretched":false,"file":{"url":"https://py4web.leiden.dockers.local/img/upload/23.png?hash=979795a433fc15cb94eccb3159f1f1e4054b1664"}}}],"version":"2.30.7"}"""
|
|
266
263
|
e = EditorJS.from_json(js)
|
|
267
264
|
|
|
@@ -269,6 +266,14 @@ def test_figcaption():
|
|
|
269
266
|
|
|
270
267
|
assert "figcaption" in html
|
|
271
268
|
|
|
269
|
+
def test_bold():
|
|
270
|
+
js = """{"time":1742475802066,"blocks":[{"id":"v_Kc51dnJH","type":"paragraph","data":{"text":"Deze tekst is <b>half bold</b> en half niet"},"tunes":{"alignmentTune":{"alignment":"left"}}},{"id":"q_fkuEFcY5","type":"paragraph","data":{"text":"<b>Deze tekst is heel bold</b>"},"tunes":{"alignmentTune":{"alignment":"left"}}}],"version":"2.30.7"}"""
|
|
271
|
+
|
|
272
|
+
e = EditorJS.from_json(js)
|
|
273
|
+
|
|
272
274
|
print(
|
|
273
|
-
|
|
275
|
+
e._mdast,
|
|
276
|
+
e.to_json(),
|
|
277
|
+
e.to_html(),
|
|
278
|
+
e.to_markdown(),
|
|
274
279
|
)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "2.5.0a1"
|
|
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
|