Two days ago I released a npm module named Docmark. As the description suggests it extracts Markdown content from doc comments, but the main idea behind it is that you can use it to generate documentation.

Let’s says we have a CSS file with the following content:

 * # `module`
 * A module.
 * <p class="module">
 *   Module
 * </p>
 * ~~~ html
 * <p class="module">
 *   <!-- ... -->
 * </a>
 * ~~~

.module {}

After you run the file through Docmark you should have this:

# `module`

A module.

<p class="module">

~~~ html
<p class="module">
  <!-- ... -->

And if we run that through Pandoc we get this:

<h1 id="module"><code>module</code></h1>
<p>A module.</p>
<p class="module">
<pre class="sourceCode html"><code class="sourceCode html"><span class="kw">&lt;p</span><span class="ot"> class=</span><span class="st">&quot;module&quot;</span><span class="kw">&gt;</span>
  <span class="co">&lt;!-- ... --&gt;</span>
<span class="kw">&lt;/a&gt;</span></code></pre>

To customize it to your liking you can use your own HTML template with Pandoc’s --template option.

comments powered by Disqus