ui-markdown 1.0.0__py3-none-any.whl

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.
@@ -0,0 +1,242 @@
1
+ Metadata-Version: 2.4
2
+ Name: ui-markdown
3
+ Version: 1.0.0
4
+ Summary: UI-Markdown — Interactive Notion-style visual documents in pure plain text
5
+ Author: UI-Markdown Team
6
+ Keywords: markdown,ui,notion,documents,interactive,editor
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Topic :: Text Processing :: Markup
10
+ Classifier: Topic :: Text Editors :: Integrated Development Environments (IDE)
11
+ Requires-Python: >=3.9
12
+ Description-Content-Type: text/markdown
13
+
14
+ <div align="center">
15
+
16
+ # UI-Markdown (UMD)
17
+
18
+ **Interactive Notion-Style Visual Documents in Pure Plain Text**
19
+
20
+ [![Python Version](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/)
21
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
22
+ [![Tests](https://img.shields.io/badge/tests-68%20passed-brightgreen.svg)]()
23
+ [![Zero Dependencies](https://img.shields.io/badge/dependencies-0%20external-purple.svg)]()
24
+
25
+ *Combine fluid Markdown writing with reactive UI blocks, data charts, and pipeline architectures — stored cleanly in a single `.umd` file with zero companion files.*
26
+
27
+ <br/>
28
+
29
+ <img src="assets/screenshot_01_editor_overview.png" alt="UI-Markdown Visual Editor: Stat Cards and Architecture Pipeline" width="900" style="border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,0.4);" />
30
+
31
+ </div>
32
+
33
+ ---
34
+
35
+ ## 🌟 Overview
36
+
37
+ **UI-Markdown (`.umd`)** bridges the gap between readable plain-text Markdown and rich visual workspace editors like Notion.
38
+
39
+ Traditional documentation tools often force you to choose between:
40
+ 1. **Plain Markdown**: Lightweight and Git-friendly, but visually plain with limited interactivity and no structured visual components.
41
+ 2. **Proprietary Workspace Apps**: Visually rich, but stored in proprietary databases or accompanied by messy multi-file bundles (`.html`, `.json`, folder companions).
42
+
43
+ **UMD solves this.** Every document is stored entirely in **pure human-readable text** under the `.umd` extension, with an AST-backed parser guaranteeing **100% lossless roundtrip preservation**.
44
+
45
+ <div align="center">
46
+ <img src="assets/screenshot_02_pipeline_cards.png" alt="Inference Pipeline and Benchmark Evaluation" width="880" style="border-radius: 8px; margin: 16px 0;" />
47
+ </div>
48
+
49
+ ---
50
+
51
+ ## ✨ Key Features
52
+
53
+ - **📄 Zero Companion Files**: Everything — text, metrics, bar charts, pie charts, pipelines, callouts, and tables — lives inside one plain `.umd` text file.
54
+ - **🎨 Interactive Visual Editor**: Seamless WYSIWYG editor built for **Antigravity IDE** and **VS Code**, featuring full keyboard navigation, right-click component menus, and real-time live preview.
55
+ - **🔄 Lossless Bi-Directional Roundtrip**: Visual changes immediately sync back to clean Markdown without reordering, mangling comments, or breaking formatting.
56
+ - **📊 AI & Data Graphics Built-In**:
57
+ - **Horizontal Bar Charts**: Benchmark comparisons with proportional bars.
58
+ - **Vertical Column Charts**: Latency, batch sizes, and context profiles.
59
+ - **Pie / Donut Charts**: Dataset mixture and token distributions.
60
+ - **AI Pipeline Architecture**: End-to-end model workflows (`Prompt -> Tokenizer -> Transformer -> Output`).
61
+ - **Progress Cards**: Multi-stage fine-tuning and alignment tracking.
62
+ - **🛡️ Security-First Core**: Built-in XSS defense, attribute breakout protection, sanitized URLs (`javascript:`/`vbscript:` neutralization), and resilient fuzz handling.
63
+ - **⚡ Zero External Dependencies**: Core engine is 100% standard-library Python with lightning-fast execution (<1ms parse time).
64
+
65
+ ---
66
+
67
+ ## 📊 Rich AI & Data Visualizations
68
+
69
+ ### 1. Benchmark Horizontal Bar Charts
70
+ Compare LLM benchmarks, evaluation scores, or accuracy metrics with auto-calculated visual bars:
71
+
72
+ <div align="center">
73
+ <img src="assets/screenshot_03_benchmark_charts.png" alt="Benchmark Horizontal Bar Chart" width="880" style="border-radius: 8px; margin: 16px 0;" />
74
+ </div>
75
+
76
+ ### 2. Vertical Column & Pie / Donut Charts
77
+ Visualize latency curves across context lengths and dataset token distributions with interactive legends:
78
+
79
+ <div align="center">
80
+ <img src="assets/screenshot_04_pie_column_charts.png" alt="Vertical Column Chart and Pie/Donut Chart" width="880" style="border-radius: 8px; margin: 16px 0;" />
81
+ </div>
82
+
83
+ ### 3. Reactive Progress, Callouts & Checklists
84
+ Track alignment stages with progress meters, status banners, and interactive task checkboxes:
85
+
86
+ <div align="center">
87
+ <img src="assets/screenshot_05_checklist_callouts.png" alt="Progress Cards, Alert Callouts, and Task Checklists" width="880" style="border-radius: 8px; margin: 16px 0;" />
88
+ </div>
89
+
90
+ ---
91
+
92
+ ## 🚀 Quick Start
93
+
94
+ ### 1. Installation
95
+
96
+ Install via pip:
97
+
98
+ ```bash
99
+ pip install ui-markdown
100
+ ```
101
+
102
+ ### 2. Install the IDE Extension
103
+
104
+ Activate the visual editor in VS Code and Antigravity IDE with a single command:
105
+
106
+ ```bash
107
+ umd install
108
+ ```
109
+
110
+ > **Tip:** Reload your IDE (`Ctrl+Shift+P > Developer: Reload Window`). Click any `.umd` file to open it directly in the Notion-like visual editor!
111
+
112
+ ---
113
+
114
+ ## 💻 CLI Commands
115
+
116
+ The `umd` CLI provides high-performance document tools:
117
+
118
+ ```bash
119
+ # Render a .umd document to standalone HTML
120
+ umd render document.umd -o document.html
121
+
122
+ # Validate syntax and check for structural errors
123
+ umd check document.umd
124
+
125
+ # Open the visual editor server
126
+ umd edit document.umd
127
+
128
+ # Re-install or update the IDE extension
129
+ umd install
130
+ ```
131
+
132
+ ---
133
+
134
+ ## 🧩 Syntax & Component Reference
135
+
136
+ UMD supports all standard CommonMark syntax along with reactive block components:
137
+
138
+ ### 1. AI & Data Charts
139
+ ```markdown
140
+ [CHART title="Zero-Shot Reasoning Benchmark Scores (%)" type="bar"]
141
+ GPT-4o | 88.5
142
+ Claude 3.5 Sonnet | 89.2
143
+ DeepSeek-V3 | 88.8
144
+ DeepReason-70B (Ours) | 92.4
145
+ [/CHART]
146
+
147
+ [CHART title="Inference Latency by Context Length (ms)" type="column"]
148
+ 2k Tokens | 14.2
149
+ 8k Tokens | 22.8
150
+ 32k Tokens | 41.5
151
+ 128k Tokens | 104.3
152
+ [/CHART]
153
+
154
+ [CHART title="Pretraining Dataset Mixture (%)" type="pie"]
155
+ Code & Repositories | 35
156
+ Scientific Papers | 25
157
+ Web Curated Text | 20
158
+ Mathematical Proofs | 12
159
+ Conversational Dialog | 8
160
+ [/CHART]
161
+ ```
162
+
163
+ ### 2. Architecture Pipelines
164
+ ```markdown
165
+ [PIPELINE title="End-to-End Inference Pipeline"]
166
+ User Query -> Semantic Tokenizer -> Mixture of Attention Layers -> Tool Calling Router -> Verifier Agent -> Streaming Output
167
+ [/PIPELINE]
168
+ ```
169
+
170
+ ### 3. Stat Cards & Columns
171
+ ```markdown
172
+ [COLUMNS gap="20"]
173
+
174
+ [CARD title="PARAMETERS"]
175
+ 70.6 Billion (Dense Decoder-Only)
176
+ [/CARD]
177
+
178
+ [CARD title="CONTEXT WINDOW"]
179
+ 128,000 tokens
180
+ [/CARD]
181
+
182
+ [CARD title="TARGET MODALITY"]
183
+ Code, Math & Multi-Step Reasoning
184
+ [/CARD]
185
+
186
+ [/COLUMNS]
187
+ ```
188
+
189
+ ### 4. Reactive Callouts & Progress
190
+ ```markdown
191
+ [PROGRESS label="Stage 2 Reinforcement Learning (RLVR)" value="94" max="100" /]
192
+
193
+ [CALLOUT tone="success" title="Verification Passed"]
194
+ All unit benchmarks, safety filters, and latency boundaries passed.
195
+ [/CALLOUT]
196
+ ```
197
+
198
+ ---
199
+
200
+ ## 🐍 Python API
201
+
202
+ Integrate UMD programmatically into your scripts, CI/CD pipelines, or agent workflows:
203
+
204
+ ```python
205
+ from umd import parse, render_document, Document
206
+
207
+ # 1. Parse UMD text into an AST
208
+ doc_text = """
209
+ # Model Evaluation
210
+ [PROGRESS label="Fine-Tuning" value=95 max=100 /]
211
+ """
212
+ result = parse(doc_text)
213
+ print(f"Parsed {len(result.root.children)} root nodes.")
214
+
215
+ # 2. Render to self-contained HTML
216
+ html_output = render_document(doc_text, standalone=True)
217
+ with open("evaluation.html", "w", encoding="utf-8") as f:
218
+ f.write(html_output)
219
+
220
+ # 3. Document Object Model editing
221
+ doc = Document.from_text(doc_text)
222
+ doc.append_paragraph("Evaluation completed successfully.")
223
+ print(doc.to_text())
224
+ ```
225
+
226
+ ---
227
+
228
+ ## 🧪 Testing & Verification
229
+
230
+ UMD includes a comprehensive test suite covering parser grammar, AST validation, roundtrip persistence, security escaping, and visual rendering:
231
+
232
+ ```bash
233
+ pytest tests/
234
+ ```
235
+
236
+ **Status:** 68 passed (100% coverage across editing, parsing, rendering, roundtrip, and security modules).
237
+
238
+ ---
239
+
240
+ ## 📄 License
241
+
242
+ MIT License. Free and open-source for personal, academic, and enterprise software.
@@ -0,0 +1,41 @@
1
+ umd/__init__.py,sha256=n_5AdG0BtGzjr7LtQidis85x9yQkm_hBtd1F5bAkrMM,1276
2
+ umd/__main__.py,sha256=Fzue4XeTT_VX1xw5da8lrZFp8_3b2a6DCY9XCU09s8o,441
3
+ umd/app.py,sha256=xfvZtrsFXiQ_xMdFD1eXgnaIXGl61oZ2NN1HOkN-HnE,3620
4
+ umd/cli.py,sha256=5FEoFLavks7TM9xbtPmm5YFX0kbYWK-Ixn3DiySwIHM,9807
5
+ umd/editor.html,sha256=gNpre_Awo5ODcwzJtpyiMLlP6vOxW-1snl1s2OfYbCU,92559
6
+ umd/extension_template.js,sha256=ge8Ri-Y6AMVtTYfZUeZu3qDxnfvT3Mv1WanCTrlSMfA,2795
7
+ umd/installer.py,sha256=p2JvifW0AW7BnO-SkEFKvBKGcvVQY6umt7Xy9rhM0kw,2605
8
+ umd/components/__init__.py,sha256=iLYjvKs3_n7qS3pdjyDEPN210Yme4sF11kPxH02f2dU,309
9
+ umd/components/base.py,sha256=0Gmnijg0MtRtUT1QHzNiuGXHfAP2g4lwDtLxsuaBuFs,3960
10
+ umd/components/card.py,sha256=Y6RSHCBQ9mycCk9ZcEMgoaV1JP-FBYhmXYtHHXx1cJM,1441
11
+ umd/components/chart.py,sha256=RuH8Ekt8fkU0VRucNH0Zfm4X3g7Fx5VMJNQsUhbTrcQ,420
12
+ umd/components/image.py,sha256=XX3VVhEQawu23nAQ4I-H9Cyv0rBHMTCAk5hXFaWJMAo,1001
13
+ umd/components/pipeline.py,sha256=ZrXozpvNo0miJ9a8QJhylW-XdJHRP59Kale1xps_Fis,335
14
+ umd/components/progress.py,sha256=ao00Z-fbkmxmNXb6j3_RTcNbu_jO1-PyrswPPH7LsLQ,374
15
+ umd/components/registry.py,sha256=dQm172FqAYdAF86PfG-RWH0lQBTyGsoxgC-P2hvCOy4,1569
16
+ umd/components/table.py,sha256=79X9c3uRgE1YqLoSWWgBErBl1sf-vF8LmVBwM_AsLR0,6246
17
+ umd/components/tasks.py,sha256=idjek_KQdW3-Eyb1Lxoj_nAGk8RbRCFGbwQkQ86Vmmc,274
18
+ umd/core/__init__.py,sha256=XSghLS7FQ2h52Yxkc6vdmOTS-pFCcLx2nk6RCrQrxZI,415
19
+ umd/core/ast.py,sha256=oWFA6ccCi0XfrYkSecb9H35nAAaxF1HRYzD-uBQbvZY,3682
20
+ umd/core/lexer.py,sha256=SPUK0SMdL2UN3xdDJoWKspg13YcPIwyO0Bng8rbVWfg,5149
21
+ umd/core/parser.py,sha256=1ydFR-r50P4mdjTf6INRMPoE-lfjfc35ZwjApRADj-M,6531
22
+ umd/core/tokens.py,sha256=ZlY0BkYCMBPe7rwI8FH7Z3eWwktxjvg4gS092cm6spg,1678
23
+ umd/core/validator.py,sha256=x1TbDpwdaE7xO1wgWqgwZQpAEPiL706wu465EI01uXw,1467
24
+ umd/document/__init__.py,sha256=IFro8t7j6Zb1dLIyedOZAlyQVJikziwNWDbId5SxvpE,464
25
+ umd/document/history.py,sha256=bYkX8nCqzMEhr6dfXUk5nRd-19uOmvxHcftkqsbL_t4,1339
26
+ umd/document/model.py,sha256=UlJBUfyWXb6CcdAsrs-liuxkgmq2aVZorHkshMc8rMI,10995
27
+ umd/document/patches.py,sha256=OSe1kmwJiiFoUJ1rCivLtXjk4UHeQcXKTQ6-2-Ir2JQ,1974
28
+ umd/document/persistence.py,sha256=7tixMb0jrpEOaylSaR_OIQ9gj8WbcJi-e76TvZbJpCM,628
29
+ umd/document/source_map.py,sha256=92SmwLDrWi_HB4MS5x6dJ069EPLNNYsTfN7Y8jQ1Zb8,4473
30
+ umd/markdown/__init__.py,sha256=UE9Yg0edYqybVe-35Rd9QPwEMu9hqCWekG2HPBfBAII,137
31
+ umd/markdown/block.py,sha256=YQWfRT5p7PAQKaiQgya4gPFQg5A509e97LWIGU6d8uE,6970
32
+ umd/markdown/inline.py,sha256=kV7fBJU5GDxUqeaIUG1YjwKtU21nEeus2xbU2QsbGnc,2576
33
+ umd/markdown/nodes.py,sha256=9QbpgKj7Rny5RUyK9TZmwguZbunz4lY1noDVoMCHQhw,164
34
+ umd/renderers/__init__.py,sha256=RsKhEW4mJLUM65K0-luCA9Q0FR9Kfhr4COqxzS5-OGs,237
35
+ umd/renderers/html.py,sha256=w5_n0kSPHk9lMave-ZRkd03sp5onqyS9HoPiTt88w0Q,15255
36
+ umd/renderers/theme.py,sha256=tjaAGVKUylZqs2Z5VmasgPfgQi4fIAm8We-AqQAKrLk,9036
37
+ ui_markdown-1.0.0.dist-info/METADATA,sha256=XZvs7mautr1cZumlxCQICm39Y0p5jpgckmVpLjCtPVI,7987
38
+ ui_markdown-1.0.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
39
+ ui_markdown-1.0.0.dist-info/entry_points.txt,sha256=BG5kq3a_ZSd_PE9KIywpjuytct_ZANlvcooikno4oq4,57
40
+ ui_markdown-1.0.0.dist-info/top_level.txt,sha256=e_Gi0ev15CClu44RZtzeyuVygPPAlX-TaEKmp0JCVhY,4
41
+ ui_markdown-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ uimd = umd.cli:main
3
+ umd = umd.cli:main
@@ -0,0 +1 @@
1
+ umd
umd/__init__.py ADDED
@@ -0,0 +1,52 @@
1
+ """UMD — UI Markdown.
2
+
3
+ Formato de documento em texto puro com componentes visuais. O motor é
4
+ independente de qualquer renderizador: ``parse`` produz AST + spans, e o
5
+ ``Document`` mantém o texto original como fonte da verdade.
6
+
7
+ Uso rápido::
8
+
9
+ from umd import parse_umd, open_document
10
+
11
+ resultado = parse_umd("# Olá")
12
+ doc = open_document("relatorio.umd")
13
+ doc.set_cell("table#1", 1, 2, "R$ 13.000")
14
+ doc.save()
15
+ """
16
+ from __future__ import annotations
17
+
18
+ from .core.parser import ParseResult, parse as parse_umd
19
+ from .core.validator import validate
20
+ from .document.model import Document
21
+ from .document.persistence import open_document, save_document
22
+
23
+ open = open_document
24
+
25
+
26
+ def view(path: str) -> None:
27
+ """Abre a visualização interativa do documento direto da memória (sem salvar HTML)."""
28
+ import argparse
29
+ from .cli import cmd_view
30
+ cmd_view(argparse.Namespace(file=str(path)))
31
+
32
+
33
+ # Auto-habilita suporte transparente ao editor no ambiente do usuário
34
+ try:
35
+ from .installer import install_extension
36
+ install_extension()
37
+ except Exception:
38
+ pass
39
+
40
+
41
+ __version__ = "1.0.0"
42
+ __all__ = [
43
+ "Document",
44
+ "ParseResult",
45
+ "open",
46
+ "open_document",
47
+ "parse_umd",
48
+ "save_document",
49
+ "validate",
50
+ "view",
51
+ "__version__",
52
+ ]
umd/__main__.py ADDED
@@ -0,0 +1,15 @@
1
+ """Ponto de entrada: ``python -m umd``."""
2
+ from __future__ import annotations
3
+
4
+ import io
5
+ import sys
6
+
7
+ if hasattr(sys.stdout, "buffer"):
8
+ sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8", errors="replace")
9
+ if hasattr(sys.stderr, "buffer"):
10
+ sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding="utf-8", errors="replace")
11
+
12
+ from .cli import main # noqa: E402
13
+
14
+ if __name__ == "__main__":
15
+ raise SystemExit(main())
umd/app.py ADDED
@@ -0,0 +1,109 @@
1
+ """Aplicativo desktop nativo do UMD (via pywebview ou navegador local).
2
+
3
+ Abre o arquivo .umd diretamente em uma janela nativa interativa estilo Notion.
4
+ Qualquer clique, edição de célula ou nova linha salva automaticamente no arquivo .umd em texto puro.
5
+ Zero arquivos HTML gerados no disco.
6
+ """
7
+ from __future__ import annotations
8
+
9
+ import base64
10
+ from pathlib import Path
11
+
12
+
13
+ class UmdBridge:
14
+ """Ponte entre a interface visual e o arquivo .umd no disco."""
15
+
16
+ def __init__(self, file_path: Path):
17
+ self.file_path = file_path
18
+
19
+ def save(self, text: str) -> bool:
20
+ try:
21
+ self.file_path.write_text(text, encoding="utf-8")
22
+ return True
23
+ except Exception as exc:
24
+ print(f"Erro ao salvar: {exc}")
25
+ return False
26
+
27
+ def load(self) -> str:
28
+ if self.file_path.exists():
29
+ return self.file_path.read_text(encoding="utf-8")
30
+ return ""
31
+
32
+
33
+ def build_html(file_path: Path) -> str:
34
+ """Gera a página HTML interativa usando o template visual oficial do UMD."""
35
+ content = ""
36
+ if file_path.exists():
37
+ content = file_path.read_text(encoding="utf-8")
38
+
39
+ if not content.strip():
40
+ content = (
41
+ f"# {file_path.stem.capitalize()}\n\n"
42
+ "Documento interativo UMD.\n\n"
43
+ "[TABLE title=\"Tabela de Dados\"]\n"
44
+ "Item | Quantidade | Valor\n"
45
+ "Exemplo | 1 | R$ 100\n"
46
+ "[/TABLE]\n"
47
+ )
48
+ file_path.write_text(content, encoding="utf-8")
49
+
50
+ b64_content = base64.b64encode(content.encode("utf-8")).decode("ascii")
51
+ template_path = Path(__file__).resolve().parent / "editor.html"
52
+ template = template_path.read_text(encoding="utf-8")
53
+ return template.replace("__INITIAL_CONTENT_BASE64__", b64_content)
54
+
55
+
56
+ def run_app(file_path: str | Path) -> int:
57
+ """Inicia a janela nativa do UMD."""
58
+ target = Path(file_path).resolve()
59
+ bridge = UmdBridge(target)
60
+ html_doc = build_html(target)
61
+
62
+ try:
63
+ import webview
64
+ window = webview.create_window(
65
+ title=f"UMD — {target.name}",
66
+ html=html_doc,
67
+ js_api=bridge,
68
+ width=920,
69
+ height=750,
70
+ min_size=(640, 500)
71
+ )
72
+ webview.start()
73
+ return 0
74
+ except Exception as exc:
75
+ # Fallback para servidor local se WebView2 não estiver disponível
76
+ import http.server
77
+ import webbrowser
78
+
79
+ class Handler(http.server.BaseHTTPRequestHandler):
80
+ def do_GET(self):
81
+ body = html_doc.encode("utf-8")
82
+ self.send_response(200)
83
+ self.send_header("Content-Type", "text/html; charset=utf-8")
84
+ self.send_header("Content-Length", str(len(body)))
85
+ self.end_headers()
86
+ self.wfile.write(body)
87
+
88
+ def do_POST(self):
89
+ if self.path == "/api/save":
90
+ length = int(self.headers.get("Content-Length", 0))
91
+ raw_text = self.rfile.read(length).decode("utf-8")
92
+ bridge.save(raw_text)
93
+ self.send_response(200)
94
+ self.end_headers()
95
+ self.wfile.write(b"ok")
96
+
97
+ def log_message(self, *args):
98
+ pass
99
+
100
+ server = http.server.HTTPServer(("127.0.0.1", 0), Handler)
101
+ port = server.server_address[1]
102
+ url = f"http://127.0.0.1:{port}"
103
+ print(f"Abrindo UMD em {url}...")
104
+ webbrowser.open(url)
105
+ try:
106
+ server.serve_forever()
107
+ except KeyboardInterrupt:
108
+ pass
109
+ return 0