Compare commits

..

No commits in common. "dda2fc15b24688b0bb52d166f9b4a9f818a01c9d" and "3398dd2baead90fd965c782eca4bbea38f1be307" have entirely different histories.

5 changed files with 32 additions and 52 deletions

View File

@ -10,36 +10,31 @@ Docster is a Haskell CLI tool that converts Markdown files with embedded Mermaid
### Build
```bash
stack build
cabal build
```
### Run
```bash
# Convert to PDF
stack exec docster -- -pdf path/to/file.md
cabal run docster -- -pdf path/to/file.md
# Convert to HTML
stack exec docster -- -html path/to/file.md
```
### Test
```bash
stack test
cabal run docster -- -html path/to/file.md
```
### Test a single file
```bash
stack exec docster -- -pdf mermaid-to-svg/sample.md
cabal run docster -- -pdf mermaid-to-svg/sample.md
```
### Clean build artifacts
```bash
stack clean
cabal clean
```
### Interactive development
```bash
stack repl
cabal repl
```
## Architecture
@ -62,11 +57,17 @@ The tool uses Pandoc's AST transformation capabilities to:
## Dependencies
External requirements:
- Stack (install via ghcup) — manages GHC 9.10.3 automatically via lts-24.34
- Pandoc library (Haskell dependency, pulled by Stack)
- GHC 9.12.2 and Cabal 3.16 (install via ghcup)
- Pandoc library
- TeX Live (for PDF generation via XeLaTeX)
- Mermaid CLI (`npm install -g @mermaid-js/mermaid-cli`)
- pkg-config, libgmp-dev, libffi-dev, zlib1g-dev (see `install-deps.sh`)
To install GHC and Cabal:
```bash
source ~/.ghcup/env && ghcup install ghc 9.12.2
source ~/.ghcup/env && ghcup install cabal 3.16.0.0
source ~/.ghcup/env && ghcup set ghc 9.12.2
```
## Common Issues

View File

@ -13,14 +13,12 @@ Mermaid code blocks (```mermaid) will be rendered to SVG and embedded.
### Prerequisites
Install the required system dependencies (Ubuntu/Debian):
First install the required system dependencies:
```bash
./install-deps.sh
```
This installs build-essential, libgmp-dev, libffi-dev, zlib1g-dev, pkg-config, and TeX Live packages for PDF generation.
### Install Haskell toolchain
Install ghcup (Haskell toolchain installer):
@ -30,26 +28,13 @@ curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
source ~/.ghcup/env
```
#### Option A: Build with Stack (recommended)
Stack manages its own GHC installation automatically.
Install specific GHC and Cabal versions:
```bash
ghcup install stack
stack build
stack install
```
This uses the resolver defined in `stack.yaml` (currently lts-24.34 / GHC 9.10.3).
#### Option B: Build with Cabal
```bash
ghcup install ghc 9.10.3
ghcup install ghc 9.12.2
ghcup install cabal 3.16.0.0
ghcup set ghc 9.10.3
ghcup set ghc 9.12.2
ghcup set cabal 3.16.0.0
cabal install --installdir=$HOME/.local/bin
```
### Install Mermaid CLI
@ -58,24 +43,18 @@ cabal install --installdir=$HOME/.local/bin
npm install -g @mermaid-js/mermaid-cli
```
### PATH setup
Make sure the install location is in your PATH. Add to your shell config if needed:
### Build and install docster
```bash
# For Stack
export PATH="$HOME/.local/bin:$PATH"
cabal install --installdir=$HOME/.local/bin
```
# For Cabal
Make sure `~/.local/bin` is in your PATH. Add to your shell config if needed:
```bash
export PATH="$HOME/.local/bin:$PATH"
```
## Development
```bash
stack build # compile
stack test # run tests
stack repl # interactive REPL
```
See [agents.md](agents.md) for information about the Claude Code agents used for Haskell refactoring in this project.

View File

@ -1,2 +1,2 @@
sudo apt update
sudo apt install -y build-essential pkg-config libgmp-dev libffi-dev zlib1g-dev texlive-latex-base texlive-fonts-recommended texlive-latex-extra texlive-xetex
sudo apt install -y build-essential libgmp-dev libffi-dev zlib1g-dev texlive-latex-base texlive-fonts-recommended texlive-latex-extra texlive-xetex

View File

@ -1,4 +1,4 @@
resolver: lts-24.34 # GHC 9.10.3
resolver: lts-22.39 # GHC 9.12.2 compatible
packages:
- .

View File

@ -6,7 +6,7 @@
packages: []
snapshots:
- completed:
sha256: 45b164eaf5c16bd220d2c5d7ab9a66ca0cfbcde7753703a5cb3549172adde813
size: 728959
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/24/34.yaml
original: lts-24.34
sha256: 6c5aeace2ca5ecde793a9e0acfaa730ec8f384aa2f6183a2a252f5f9ec55d623
size: 720039
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/22/39.yaml
original: lts-22.39