Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 62 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,81 @@
# nixie

`nixie` is a simple command-line tool that validates Mermaid diagrams embedded in Markdown files.
`nixie` validates Mermaid diagrams embedded in Markdown files.

The CLI scans each provided file (or directory) for `mermaid` code blocks and
invokes `mermaid-cli` to verify that the diagrams can be rendered without
errors.
## Features

## Usage
- Recursively searches directories for Markdown files
- Parses `mermaid` code blocks and uses `@mermaid-js/mermaid-cli` to validate
- Runs checks concurrently for faster feedback
- Prints clear error messages for failing diagrams

## Requirements

- Python 3.11+
- Node.js with `npx` and `@mermaid-js/mermaid-cli`

## Installation

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Consider adding installation instructions for end-users.

If nixie is meant for non-developers, please include standard installation steps (e.g., pip install nixie) in addition to development setup.


### From PyPI

End users can install the latest release directly from PyPI:

```bash
nixie path/to/file.md
pip install nixie
```

Use `--concurrency` to control how many diagrams are processed in parallel. The tool relies on
Node.js and `@mermaid-js/mermaid-cli` being available on your system.
This provides the `nixie` command without any development extras.

## Development
### Development Setup

Development dependencies are managed via `pyproject.toml`. After installing
[uv](https://github.com/astral-sh/uv), run:
To contribute to nixie, install the package in editable mode and set up
development tools using [uv](https://docs.astral.sh/uv/), Astral's fast Python
package manager:

```bash
pip install -e .
uv sync --include dev
```

This installs linters and test tools such as Ruff, Pyright, pytest and
pytest-asyncio.
## Usage

```bash
nixie [--concurrency N] FILE [FILE...]
```

`--concurrency` controls how many diagrams are processed in parallel (defaults
to the number of CPU cores or `4` if this cannot be determined). Paths can be
files or directories.

Before running the test suite, install the project in editable mode so the
package can be imported:
Example:

```bash
pip install -e .
$ nixie bad.md
Parse error on line 1:
invalid diagram
^
Unexpected token: syntax error
```

## Development

Run formatting, linting, type checking and tests before committing:

```bash
ruff format
ruff check
pyright
pytest
```

The integration tests mock the CLI so Node.js is not needed during testing.

## Project Structure

- `nixie/cli.py` – command-line interface and validation logic
- `nixie/unittests/` – unit tests for helper functions
- `tests/integration/` – behavioural tests covering the CLI

## License

See `LICENSE` for license details.