Metadata-Version: 2.4
Name: chromamark
Version: 0.1.3
Summary: ChromaMark for Python — render and build colored blocks, pills, collapsibles, fields, meters and inline diff on top of Markdown, with Jupyter display.
Author: cjfravel-dev
License: Copyright 2026 CJ Fravel
        
        Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
        
        1. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
        
        2. **SaaS Provision**: If you use this software to provide a Software-as-a-Service (SaaS) offering, you must provide access to the source code of the modified version of the Software that you are using in your service, under the terms of this license. The access must be provided within a reasonable time, but no later than 30 days, and the access method should be publicly documented.
        
        THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
        
        ---
        
        ## Third-party components
        
        The published browser bundles in `packages/renderer/dist/` and the bundled VS Code extension embed [markdown-it](https://github.com/markdown-it/markdown-it), which is licensed under the [MIT License](https://github.com/markdown-it/markdown-it/blob/master/LICENSE).
        
Project-URL: Homepage, https://github.com/cjfravel-dev/ChromaMark
Project-URL: Source, https://github.com/cjfravel-dev/ChromaMark
Project-URL: Issues, https://github.com/cjfravel-dev/ChromaMark/issues
Keywords: chromamark,markdown,markdown-it,jupyter,report,agent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Text Processing :: Markup :: Markdown
Classifier: Framework :: Jupyter
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE.md
Requires-Dist: markdown-it-py[linkify]>=3.0
Provides-Extra: test
Requires-Dist: pytest; extra == "test"
Dynamic: license-file

# chromamark (Python)

Render and build [ChromaMark](https://github.com/cjfravel-dev/ChromaMark) from
Python — colored blocks, pills, collapsible sections, fields, meters, and inline
diff on top of Markdown (CommonMark + GFM). Produces the **same HTML** as the JS
renderer, so the same theme applies, and it displays inline in Jupyter.

Built on [markdown-it-py](https://github.com/executablebooks/markdown-it-py).

## Install

```bash
pip install chromamark
```

## Render

```python
from chromamark import render, create_renderer

html = render("::: success\nAll good [!ok pass]\n:::")

# or as a markdown-it-py plugin:
from markdown_it import MarkdownIt
from chromamark import chromamark_plugin
md = MarkdownIt("commonmark").use(chromamark_plugin)
```

## Build (fluent, for agent reports)

```python
from chromamark import ChromaDoc

doc = ChromaDoc()
doc.heading("Deploy report")
doc.success("Deploy succeeded", "3/3 replicas healthy")
doc.fields(Region="eastus", Status=doc.pill("ok", "healthy"))
doc.table(["Stage", "Result"], [["unit", doc.pill("pass", "247")]])
print(doc.to_cm())     # ChromaMark source
print(doc.to_html())   # rendered HTML
```

## Jupyter

```python
from chromamark import display_chromamark
display_chromamark("::: success\nRun complete [=success 100%]\n:::")
```

`ChromaDoc` also renders itself in notebooks via `_repr_html_`.

A runnable, pre-executed example notebook lives at
[`examples/chromamark_report.ipynb`](./examples/chromamark_report.ipynb) — it
builds a model-evaluation report (colored block, pills, meters, fields, a table,
and a collapsible) from computed results.

## Parity with the JavaScript renderer

`chromamark` produces byte-identical HTML to `@chromamark/renderer` for normal
content — verified by a differential harness over ~140,000 inputs (every
ChromaMark construct, GFM, linkify, and the full SPEC/demo documents all match
exactly). Three **exotic** edge cases differ, all involving unusual whitespace or
non-BMP characters; none affect typical agent-generated reports:

- **Non-ASCII whitespace at a block edge** (e.g. a leading U+3000 ideographic
  space): JS markdown-it preserves it (`asciiTrim`); markdown-it-py strips all
  Unicode whitespace. Upstream base-engine difference.
- **Six control/format code points inside ChromaMark constructs**
  (U+001C–U+001F, U+0085 NEL, U+FEFF BOM): counted as whitespace by one engine's
  regex/`strip` but not the other, which can flip pill/field parsing.
- **Astral-plane (emoji) domain labels** in bare links (e.g. `🎉.com`): auto-linked
  by JS linkify-it but not linkify-it-py. BMP and IDN letter hosts match.

## Credits

Inline change-tracking syntax is adopted from **[CriticMarkup](http://criticmarkup.com/)**
(© 2013 Gabe Weatherhead & Erik Hess, Apache-2.0); ChromaMark's parser is an original,
independent implementation. See the
[main README](https://github.com/cjfravel-dev/ChromaMark#prior-art--credits) for full credits.

## License

Modified MIT License with a SaaS source-availability provision — see LICENSE.md.
