https://github.com/composewell/markdown-doctest
https://github.com/composewell/markdown-doctest
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/composewell/markdown-doctest
- Owner: composewell
- Created: 2022-11-04T06:04:43.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-12-06T16:55:42.000Z (over 2 years ago)
- Last Synced: 2025-03-11T17:25:30.765Z (over 1 year ago)
- Language: Haskell
- Size: 12.7 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# Markdown doctest
## Installation
```
$ cabal install markdown-doctest
```
## Usage
```
$ ./markdown-doctest
```
Note: The ghc environment file should exist.
## Syntax
3 type of codeblocks are parsed,
- `haskell`: All `haskell` blocks are tangled into a common file and checked.
- `haskell unshared`: These blocks are loaded independently and dont share anything.
- `haskell docspec`: These blocks share the syntax of docspec and share the env.
## Example
`markdown-doctest` will successfully validate this file.
```haskell
import qualified Prelude as P
```
```haskell unshared
import qualified Prelude as P
main =
P.print "Hello, World!"
```
```haskell docspec
>>> import qualified Prelude as P
```
```haskell
main =
P.print "Hello, World!"
```
```haskell docspec
>>> P.filter P.odd [1..10]
[1,3,5,7,9]
```