marklassian 0.1.0__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.
- marklassian-0.1.0/.claude/settings.local.json +10 -0
- marklassian-0.1.0/.gitignore +11 -0
- marklassian-0.1.0/.python-version +1 -0
- marklassian-0.1.0/LICENSE +21 -0
- marklassian-0.1.0/PKG-INFO +123 -0
- marklassian-0.1.0/README.md +100 -0
- marklassian-0.1.0/pyproject.toml +38 -0
- marklassian-0.1.0/src/marklassian/__init__.py +7 -0
- marklassian-0.1.0/src/marklassian/converter.py +473 -0
- marklassian-0.1.0/src/marklassian/types.py +20 -0
- marklassian-0.1.0/tests/conftest.py +87 -0
- marklassian-0.1.0/tests/fixtures/basics.json +257 -0
- marklassian-0.1.0/tests/fixtures/code-blocks.json +42 -0
- marklassian-0.1.0/tests/fixtures/gfm-nested-task-list.json +74 -0
- marklassian-0.1.0/tests/fixtures/gfm-task-list.json +40 -0
- marklassian-0.1.0/tests/fixtures/inline-code-marks.json +46 -0
- marklassian-0.1.0/tests/fixtures/nested-list.json +216 -0
- marklassian-0.1.0/tests/fixtures/special-chars.json +470 -0
- marklassian-0.1.0/tests/fixtures/table.json +169 -0
- marklassian-0.1.0/tests/fixtures/text-edge-cases.json +62 -0
- marklassian-0.1.0/tests/test_core.py +157 -0
- marklassian-0.1.0/tests/test_gfm.py +80 -0
- marklassian-0.1.0/uv.lock +172 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.12
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Michał Brotoń
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: marklassian
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Convert Markdown to Atlassian Document Format (ADF)
|
|
5
|
+
Project-URL: Homepage, https://github.com/mbroton/marklassian-py
|
|
6
|
+
Project-URL: Repository, https://github.com/mbroton/marklassian-py
|
|
7
|
+
Author-email: Michał Brotoń <michal@broton.dev>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: adf,atlassian,confluence,jira,markdown
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Topic :: Text Processing :: Markup :: Markdown
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Requires-Dist: mistune>=3.0.0
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
|
|
24
|
+
# marklassian-py
|
|
25
|
+
|
|
26
|
+
A lightweight Python library that converts Markdown to the [Atlassian Document Format (ADF)](https://developer.atlassian.com/cloud/jira/platform/apis/document/structure/). Built for easy integration with Atlassian products like Jira and Confluence.
|
|
27
|
+
|
|
28
|
+
This is a Python port of the excellent [marklassian](https://github.com/jamsinclair/marklassian) JavaScript library by [@jamsinclair](https://github.com/jamsinclair).
|
|
29
|
+
|
|
30
|
+
## Features
|
|
31
|
+
|
|
32
|
+
- Convert Markdown to ADF with a single function call
|
|
33
|
+
- Support for common Markdown syntax including GFM task lists
|
|
34
|
+
- Minimal dependencies (only [mistune](https://github.com/lepture/mistune))
|
|
35
|
+
- Full type hints for IDE support
|
|
36
|
+
- Python 3.10+
|
|
37
|
+
|
|
38
|
+
## Installation
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pip install marklassian
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Or with uv:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
uv add marklassian
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Usage
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
from marklassian import markdown_to_adf
|
|
54
|
+
|
|
55
|
+
markdown = "# Hello World\n\nThis is **bold** and *italic* text."
|
|
56
|
+
adf = markdown_to_adf(markdown)
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
The result is a dictionary that can be serialized to JSON:
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
import json
|
|
63
|
+
print(json.dumps(adf, indent=2))
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Supported Markdown Features
|
|
67
|
+
|
|
68
|
+
- Headings (H1-H6)
|
|
69
|
+
- Paragraphs and line breaks
|
|
70
|
+
- Emphasis (bold, italic, strikethrough)
|
|
71
|
+
- Links and images
|
|
72
|
+
- Inline code and code blocks with language support
|
|
73
|
+
- Ordered and unordered lists with nesting
|
|
74
|
+
- Blockquotes
|
|
75
|
+
- Horizontal rules
|
|
76
|
+
- Tables
|
|
77
|
+
- Task lists (GitHub Flavored Markdown)
|
|
78
|
+
|
|
79
|
+
## API Reference
|
|
80
|
+
|
|
81
|
+
### `markdown_to_adf(markdown: str) -> AdfDocument`
|
|
82
|
+
|
|
83
|
+
Converts a Markdown string to an ADF document object.
|
|
84
|
+
|
|
85
|
+
### Types
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
class AdfMark(TypedDict, total=False):
|
|
89
|
+
type: Required[str]
|
|
90
|
+
attrs: dict[str, Any]
|
|
91
|
+
|
|
92
|
+
class AdfNode(TypedDict, total=False):
|
|
93
|
+
type: Required[str]
|
|
94
|
+
attrs: dict[str, Any]
|
|
95
|
+
content: list[AdfNode]
|
|
96
|
+
marks: list[AdfMark]
|
|
97
|
+
text: str
|
|
98
|
+
|
|
99
|
+
class AdfDocument(TypedDict):
|
|
100
|
+
version: Literal[1]
|
|
101
|
+
type: Literal["doc"]
|
|
102
|
+
content: list[AdfNode]
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Caveats
|
|
106
|
+
|
|
107
|
+
This library aims to provide a lightweight and mostly accurate conversion from Markdown to ADF.
|
|
108
|
+
|
|
109
|
+
For complex Markdown documents or strict ADF conformance requirements, consider using the official Atlassian libraries. Note that those are heavier dependencies.
|
|
110
|
+
|
|
111
|
+
## References
|
|
112
|
+
|
|
113
|
+
- [Atlassian Document Format Reference](https://developer.atlassian.com/cloud/jira/platform/apis/document/structure/)
|
|
114
|
+
- [ADF Interactive Builder](https://developer.atlassian.com/cloud/jira/platform/apis/document/playground/)
|
|
115
|
+
- [Original marklassian (JavaScript)](https://github.com/jamsinclair/marklassian)
|
|
116
|
+
|
|
117
|
+
## Credits
|
|
118
|
+
|
|
119
|
+
This library is a Python port of [marklassian](https://github.com/jamsinclair/marklassian) by [Jamie Sinclair](https://github.com/jamsinclair). All credit for the original implementation and conversion logic goes to them.
|
|
120
|
+
|
|
121
|
+
## License
|
|
122
|
+
|
|
123
|
+
MIT - see [LICENSE](LICENSE) for details.
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# marklassian-py
|
|
2
|
+
|
|
3
|
+
A lightweight Python library that converts Markdown to the [Atlassian Document Format (ADF)](https://developer.atlassian.com/cloud/jira/platform/apis/document/structure/). Built for easy integration with Atlassian products like Jira and Confluence.
|
|
4
|
+
|
|
5
|
+
This is a Python port of the excellent [marklassian](https://github.com/jamsinclair/marklassian) JavaScript library by [@jamsinclair](https://github.com/jamsinclair).
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- Convert Markdown to ADF with a single function call
|
|
10
|
+
- Support for common Markdown syntax including GFM task lists
|
|
11
|
+
- Minimal dependencies (only [mistune](https://github.com/lepture/mistune))
|
|
12
|
+
- Full type hints for IDE support
|
|
13
|
+
- Python 3.10+
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pip install marklassian
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Or with uv:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
uv add marklassian
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
```python
|
|
30
|
+
from marklassian import markdown_to_adf
|
|
31
|
+
|
|
32
|
+
markdown = "# Hello World\n\nThis is **bold** and *italic* text."
|
|
33
|
+
adf = markdown_to_adf(markdown)
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
The result is a dictionary that can be serialized to JSON:
|
|
37
|
+
|
|
38
|
+
```python
|
|
39
|
+
import json
|
|
40
|
+
print(json.dumps(adf, indent=2))
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Supported Markdown Features
|
|
44
|
+
|
|
45
|
+
- Headings (H1-H6)
|
|
46
|
+
- Paragraphs and line breaks
|
|
47
|
+
- Emphasis (bold, italic, strikethrough)
|
|
48
|
+
- Links and images
|
|
49
|
+
- Inline code and code blocks with language support
|
|
50
|
+
- Ordered and unordered lists with nesting
|
|
51
|
+
- Blockquotes
|
|
52
|
+
- Horizontal rules
|
|
53
|
+
- Tables
|
|
54
|
+
- Task lists (GitHub Flavored Markdown)
|
|
55
|
+
|
|
56
|
+
## API Reference
|
|
57
|
+
|
|
58
|
+
### `markdown_to_adf(markdown: str) -> AdfDocument`
|
|
59
|
+
|
|
60
|
+
Converts a Markdown string to an ADF document object.
|
|
61
|
+
|
|
62
|
+
### Types
|
|
63
|
+
|
|
64
|
+
```python
|
|
65
|
+
class AdfMark(TypedDict, total=False):
|
|
66
|
+
type: Required[str]
|
|
67
|
+
attrs: dict[str, Any]
|
|
68
|
+
|
|
69
|
+
class AdfNode(TypedDict, total=False):
|
|
70
|
+
type: Required[str]
|
|
71
|
+
attrs: dict[str, Any]
|
|
72
|
+
content: list[AdfNode]
|
|
73
|
+
marks: list[AdfMark]
|
|
74
|
+
text: str
|
|
75
|
+
|
|
76
|
+
class AdfDocument(TypedDict):
|
|
77
|
+
version: Literal[1]
|
|
78
|
+
type: Literal["doc"]
|
|
79
|
+
content: list[AdfNode]
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Caveats
|
|
83
|
+
|
|
84
|
+
This library aims to provide a lightweight and mostly accurate conversion from Markdown to ADF.
|
|
85
|
+
|
|
86
|
+
For complex Markdown documents or strict ADF conformance requirements, consider using the official Atlassian libraries. Note that those are heavier dependencies.
|
|
87
|
+
|
|
88
|
+
## References
|
|
89
|
+
|
|
90
|
+
- [Atlassian Document Format Reference](https://developer.atlassian.com/cloud/jira/platform/apis/document/structure/)
|
|
91
|
+
- [ADF Interactive Builder](https://developer.atlassian.com/cloud/jira/platform/apis/document/playground/)
|
|
92
|
+
- [Original marklassian (JavaScript)](https://github.com/jamsinclair/marklassian)
|
|
93
|
+
|
|
94
|
+
## Credits
|
|
95
|
+
|
|
96
|
+
This library is a Python port of [marklassian](https://github.com/jamsinclair/marklassian) by [Jamie Sinclair](https://github.com/jamsinclair). All credit for the original implementation and conversion logic goes to them.
|
|
97
|
+
|
|
98
|
+
## License
|
|
99
|
+
|
|
100
|
+
MIT - see [LICENSE](LICENSE) for details.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "marklassian"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Convert Markdown to Atlassian Document Format (ADF)"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.10"
|
|
7
|
+
license = "MIT"
|
|
8
|
+
authors = [{ name = "Michał Brotoń", email = "michal@broton.dev" }]
|
|
9
|
+
keywords = ["markdown", "adf", "atlassian", "jira", "confluence"]
|
|
10
|
+
classifiers = [
|
|
11
|
+
"Development Status :: 4 - Beta",
|
|
12
|
+
"Intended Audience :: Developers",
|
|
13
|
+
"License :: OSI Approved :: MIT License",
|
|
14
|
+
"Programming Language :: Python :: 3",
|
|
15
|
+
"Programming Language :: Python :: 3.10",
|
|
16
|
+
"Programming Language :: Python :: 3.11",
|
|
17
|
+
"Programming Language :: Python :: 3.12",
|
|
18
|
+
"Programming Language :: Python :: 3.13",
|
|
19
|
+
"Topic :: Text Processing :: Markup :: Markdown",
|
|
20
|
+
]
|
|
21
|
+
dependencies = ["mistune>=3.0.0"]
|
|
22
|
+
|
|
23
|
+
[project.urls]
|
|
24
|
+
Homepage = "https://github.com/mbroton/marklassian-py"
|
|
25
|
+
Repository = "https://github.com/mbroton/marklassian-py"
|
|
26
|
+
|
|
27
|
+
[build-system]
|
|
28
|
+
requires = ["hatchling"]
|
|
29
|
+
build-backend = "hatchling.build"
|
|
30
|
+
|
|
31
|
+
[tool.hatch.build.targets.wheel]
|
|
32
|
+
packages = ["src/marklassian"]
|
|
33
|
+
|
|
34
|
+
[tool.pytest.ini_options]
|
|
35
|
+
testpaths = ["tests"]
|
|
36
|
+
|
|
37
|
+
[dependency-groups]
|
|
38
|
+
dev = ["pytest>=8.0.0"]
|