koka-lang / madoko

Madoko is a fast markdown processor for high quality academic and technical articles

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Embedded doctests

LeventErkok opened this issue · comments

I've been looking for a document writing system and madoko seems pretty cool. I looked through the docs, but couldn't find any specific mention for embedded tests though. Is it possible to mark code blocks for testing, as in doctest? I'm imagining something like:

```haskell
foo :: Int -> Int
foo x = x + 1
``` 

And then:

```haskell {test}
foo 3 == 4
```

The above wouldn't be rendered in the final document. And more importantly:

```haskell {doctest}
>>> foo 3
4
```

which would render the test case in the document also check that it is still true, in the style of doctest: http://hackage.haskell.org/package/doctest

Of course, the devil is in the details. Have you given this any thought or have any advice on how to go about such a system?