A markdown parser that evaluates examples and highligh syntax using unexpected

Usage no npm install needed!

<script type="module">
  import unexpectedMarkdown from 'https://cdn.skypack.dev/unexpected-markdown';


This module uses the markdown parser marked to generate html output from markdown files.

NPM version Build Status Coverage Status

In addition to what marked already offers, this module uses magicpen-prism to syntax highlight code blocks and uses unexpected to evaluate JavaScript code examples.

Right now the documentation for this plugin is pretty lacking, until that is fixed the best example on how to use the plugin is to look at how it is used in unexpected.

An example is a JavaScript code block:


If you expect the example to fail, you can follow the code block with an expected output block:

Error: Silence this is a library!

There are a few things you can achieve more then what is explained above, like async examples with promises and skiping examples for different environments or just skipping evaluation altogether. For now you'll have to look at how unexpected does it to learn the ticks.