all repos — hastyscribe @ f680b521d83a47b18538fa65e0aba5e7a3c8ddb0

A professional markdown compiler.

Upgraded to Discount v2.2.2.
h3rald h3rald@h3rald.com
Sat, 18 Feb 2017 15:42:54 +0100
commit

f680b521d83a47b18538fa65e0aba5e7a3c8ddb0

parent

530809b4301f39ec829a6e26612dd9185622b024

M README.mdREADME.md

@@ -29,8 +29,9 @@ ### Why is _HastyScribe_ different from other markdown converters?

Because: -* It is a cross-platform, self-contained executable file -* It comes with its own stylesheet, which is automatically embedded into every HTML document, along with all the needed web fonts +* It is a cross-platform, self-contained executable file. +* It can generate standalon HTML files. +* It comes with its own stylesheet, which is automatically embedded into every HTML document, along with all the needed web fonts. * It is built on top of [Discount](http://www.pell.portland.or.us/~orc/Code/discount/), which means that besides standard markdown you also get: * strikethrough * automatic Table of Contents generation

@@ -44,7 +45,7 @@ * class blocks

* tables * fenced code blocks * [Pandoc](http://johnmacfarlane.net/pandoc/)-style document headers -* It automatically embeds any referenced image via data URI +* It automatically embeds any referenced image as data URI. * It has supports for text snippets, custom fields, and substitution macros. ### What can I use it for?

@@ -57,7 +58,7 @@ HastyScribe is implemented in [Nim][nim], a very expressive language that compiles to C and is able to generate small, standalone and self-contained executable files.

### How do I build _HastyScribe_ from source? -First of all you need a **libmarkdown.a** static library. You can either grab one precompiled (for Windows or Mac OS X) from the [vendor](https://github.com/h3rald/hastyscribe/blob/master/vendor) folder of the HastyScribe repository or build your own. +First of all you need a **libmarkdown.a** static library. You can either grab a precompiled one from the [vendor](https://github.com/h3rald/hastyscribe/blob/master/vendor) folder of the HastyScribe repository or build your own. If you choose to build your own:

@@ -65,7 +66,7 @@ 1. Clone the discount [repository](https://github.com/Orc/discount).

2. In the directory containing the Discount source code, run the following commands: ``` - ./configure.sh --with-tabstops=2 --with-dl=both --with-id-anchor --with-github-tags --with-fenced-code --enable-all-features + ./configure.sh make ```
M doc/HastyScribe_UserGuide.htmdoc/HastyScribe_UserGuide.htm

@@ -78,76 +78,76 @@ <ul>

<li><a href="#Overview">Overview</a> <ul> <li><a href="#Rationale">Rationale</a></li> - <li><a href="#Key.Features">Key Features</a> + <li><a href="#Key-Features">Key Features</a> <ul> - <li><a href="#Standard.Markdown">Standard Markdown</a></li> - <li><a href="#Discount.Extensions">Discount Extensions</a></li> - <li><a href="#Text.Snippets">Text Snippets</a></li> - <li><a href="#Custom.Fields">Custom Fields</a></li> - <li><a href="#Substitution.Macros">Substitution Macros</a></li> - <li><a href="#Image..and.font..Embedding">Image (and font) Embedding</a></li> - <li><a href="#FontAwesome.Icons">FontAwesome Icons</a></li> - <li><a href="#Notes..tips..warnings..sidebars.and.badges">Notes, tips, warnings, sidebars and badges</a></li> - <li><a href="#Responsive.Design">Responsive Design</a></li> - <li><a href="#Printed.Media.Support">Printed Media Support</a> + <li><a href="#Standard-Markdown">Standard Markdown</a></li> + <li><a href="#Discount-Extensions">Discount Extensions</a></li> + <li><a href="#Text-Snippets">Text Snippets</a></li> + <li><a href="#Custom-Fields">Custom Fields</a></li> + <li><a href="#Substitution-Macros">Substitution Macros</a></li> + <li><a href="#Image-(and-font)-Embedding">Image (and font) Embedding</a></li> + <li><a href="#FontAwesome-Icons">FontAwesome Icons</a></li> + <li><a href="#Notes,-tips,-warnings,-sidebars-and-badges">Notes, tips, warnings, sidebars and badges</a></li> + <li><a href="#Responsive-Design">Responsive Design</a></li> + <li><a href="#Printed-Media-Support">Printed Media Support</a> </li> </ul> </li> </ul> </li> - <li><a href="#Getting.Started">Getting Started</a> + <li><a href="#Getting-Started">Getting Started</a> <ul> - <li><a href="#Downloading.Pre-built.Binaries">Downloading Pre-built Binaries</a></li> - <li><a href="#Installing.using.Nimble">Installing using Nimble</a></li> - <li><a href="#Building.from.Source">Building from Source</a></li> + <li><a href="#Downloading-Pre-built-Binaries">Downloading Pre-built Binaries</a></li> + <li><a href="#Installing-using-Nimble">Installing using Nimble</a></li> + <li><a href="#Building-from-Source">Building from Source</a></li> </ul> </li> <li><a href="#Usage">Usage</a> <ul> - <li><a href="#Command.Line.Syntax">Command Line Syntax</a></li> - <li><a href="#Linux.OSX.Examples">Linux/OSX Examples</a></li> - <li><a href="#Windows.Examples">Windows Examples</a></li> + <li><a href="#Command-Line-Syntax">Command Line Syntax</a></li> + <li><a href="#Linux/OSX-Examples">Linux/OSX Examples</a></li> + <li><a href="#Windows-Examples">Windows Examples</a></li> </ul> </li> - <li><a href="#Syntax.Reference">Syntax Reference</a> + <li><a href="#Syntax-Reference">Syntax Reference</a> <ul> - <li><a href="#Document.Headers">Document Headers</a></li> + <li><a href="#Document-Headers">Document Headers</a></li> <li><a href="#Snippets">Snippets</a></li> <li><a href="#Fields">Fields</a></li> <li><a href="#Macros">Macros</a></li> - <li><a href="#Inline.Formatting">Inline Formatting</a> + <li><a href="#Inline-Formatting">Inline Formatting</a> <ul> - <li><a href="#SmartyPants.Substitutions">SmartyPants Substitutions</a></li> + <li><a href="#SmartyPants-Substitutions">SmartyPants Substitutions</a></li> <li><a href="#Icons">Icons</a></li> <li><a href="#Badges">Badges</a></li> - <li><a href="#HastyScribe.Logo">HastyScribe Logo</a></li> + <li><a href="#HastyScribe-Logo">HastyScribe Logo</a></li> <li><a href="#Links">Links</a></li> </ul> </li> - <li><a href="#Block-level.Formatting">Block-level Formatting</a> + <li><a href="#Block-level-Formatting">Block-level Formatting</a> <ul> <li><a href="#Headings">Headings</a></li> <li><a href="#Tables">Tables</a></li> - <li><a href="#Block.Quotes">Block Quotes</a></li> - <li><a href="#Code.Blocks">Code Blocks</a></li> + <li><a href="#Block-Quotes">Block Quotes</a></li> + <li><a href="#Code-Blocks">Code Blocks</a></li> <li><a href="#Images">Images</a></li> <li><a href="#Lists">Lists</a> <ul> - <li><a href="#Unordered.Lists">Unordered Lists</a></li> - <li><a href="#Ordered.Lists">Ordered Lists</a></li> - <li><a href="#Alphabetical.Lists">Alphabetical Lists</a></li> - <li><a href="#Unstyled.Lists">Unstyled Lists</a></li> - <li><a href="#Nested.Lists">Nested Lists</a></li> - <li><a href="#Definition.Lists">Definition Lists</a></li> + <li><a href="#Unordered-Lists">Unordered Lists</a></li> + <li><a href="#Ordered-Lists">Ordered Lists</a></li> + <li><a href="#Alphabetical-Lists">Alphabetical Lists</a></li> + <li><a href="#Unstyled-Lists">Unstyled Lists</a></li> + <li><a href="#Nested-Lists">Nested Lists</a></li> + <li><a href="#Definition-Lists">Definition Lists</a></li> </ul> </li> - <li><a href="#Class.Blocks">Class Blocks</a> + <li><a href="#Class-Blocks">Class Blocks</a> <ul> <li><a href="#Notes">Notes</a></li> <li><a href="#Tips">Tips</a></li> <li><a href="#Warnings">Warnings</a></li> <li><a href="#Sidebars">Sidebars</a></li> - <li><a href="#Terminal.Sessions">Terminal Sessions</a> + <li><a href="#Terminal-Sessions">Terminal Sessions</a> </li> </ul>

@@ -162,13 +162,15 @@ </li>

</ul> </div> <div id="main"> -<h2 id="Overview">Overview<a href="#document-top" title="Go to top"></a></h2> +<a name="Overview"></a> +<h2>Overview<a href="#document-top" title="Go to top"></a></h2> <p><span class="hastyscribe"></span> is a self-contained <a href="https://daringfireball.net/projects/markdown/">Markdown</a> compiler that can create single-file HTML documents. All documents created by HastyScribe use well-formed HTML and embed all stylesheets, fonts, and images that are necessary to display them in any (modern) browser (don&rsquo;t even try to display them in IE8 or lower).</p> <p>In other words, all documents created by HastyScribe are constituted by only one <span class="ext">.HTML</span> file, for easy distribution.</p> -<h3 id="Rationale">Rationale<a href="#document-top" title="Go to top"></a></h3> +<a name="Rationale"></a> +<h3>Rationale<a href="#document-top" title="Go to top"></a></h3> <p>There are plenty of programs and services that can convert <a href="https://daringfireball.net/projects/markdown/">Markdown</a> into HTML but they are typically either too simple &ndash;they convert markdown code into an HTML fragment&ndash; or too complex &ndash;they produce a well-formed document, but they require too much configuration, or the installation of additional software dependencies.</p>

@@ -183,9 +185,11 @@ <li>is a single, small executable file, with no dependencies. To be fair, it&rsquo;s about 1MB in size when compiled for OSX &ndash; but that&rsquo;s only because the HastyScribe executable embeds all the fonts and stylesheets it needs to produce documents.</li>

</ul> -<h3 id="Key.Features">Key Features<a href="#document-top" title="Go to top"></a></h3> +<a name="Key-Features"></a> +<h3>Key Features<a href="#document-top" title="Go to top"></a></h3> -<h4 id="Standard.Markdown">Standard Markdown<a href="#document-top" title="Go to top"></a></h4> +<a name="Standard-Markdown"></a> +<h4>Standard Markdown<a href="#document-top" title="Go to top"></a></h4> <p>HastyScribe supports standard markdown for formatting text. Markdown is a lightweight markup language created by John Gruber, and used on many web sites and programs to enable users to write HTML code <em>without actually writing HTML tags</em>.</p>

@@ -193,7 +197,8 @@ <div class="tip"><p>Tip</p>

<p>You can learn about Markdown syntax in the <a href="#Syntax.Reference">Syntax Reference</a> section of this document. Alternatively, you can also read the original <a href="https://daringfireball.net/projects/markdown/syntax">Markdown syntax page</a> on John Gruber&rsquo;s blog, Daring Fireball.</p></div> -<h4 id="Discount.Extensions">Discount Extensions<a href="#document-top" title="Go to top"></a></h4> +<a name="Discount-Extensions"></a> +<h4>Discount Extensions<a href="#document-top" title="Go to top"></a></h4> <p>Standard markdown is great, but sometimes you wish it had a few more features, like tables or fenced code blocks perhaps. The good news is that under the hood HastyScribe uses <a href="http://www.pell.portland.or.us/~orc/Code/discount/">Discount</a>, a markdown compiler library written in C that extends markdown with a few useful extensions, which allow you to, for example:</p>

@@ -204,19 +209,23 @@ <li>create definition lists and alphabetical lists</li>

</ul> -<h4 id="Text.Snippets">Text Snippets<a href="#document-top" title="Go to top"></a></h4> +<a name="Text-Snippets"></a> +<h4>Text Snippets<a href="#document-top" title="Go to top"></a></h4> <p>Although not part of neither markdown nor Discount, HastyScribe allows you to create text <a href="#Snippets">snippets</a> to reuse content. Useful when you have to use a sentence or a formatted block of text over and over in a document, or shorten long words (like the word <em>HastyScribe</em> in this document <span class="fa-smile-o"></span>).</p> -<h4 id="Custom.Fields">Custom Fields<a href="#document-top" title="Go to top"></a></h4> +<a name="Custom-Fields"></a> +<h4>Custom Fields<a href="#document-top" title="Go to top"></a></h4> <p>HastyScribe also supports <a href="#Fields">fields</a> to easily include things like the current date or time, but also custom values specified as command-line parameters.</p> -<h4 id="Substitution.Macros">Substitution Macros<a href="#document-top" title="Go to top"></a></h4> +<a name="Substitution-Macros"></a> +<h4>Substitution Macros<a href="#document-top" title="Go to top"></a></h4> <p>If you find yourself writing chunks of text that follows the same format except for some content, you can define simple text substitution <a href="#Macros">macros</a> for even higher content reuse.</p> -<h4 id="Image..and.font..Embedding">Image (and font) Embedding<a href="#document-top" title="Go to top"></a></h4> +<a name="Image-(and-font)-Embedding"></a> +<h4>Image (and font) Embedding<a href="#document-top" title="Go to top"></a></h4> <p>HastyScribe only produces single HTML files. With <em>no dependencies</em>:</p>

@@ -226,11 +235,13 @@ <li>All referenced images (both local and remote) are automatically embedded using the <a href="http://en.wikipedia.org/wiki/Data_URI_scheme">data URI scheme</a>.</li>

</ul> -<h4 id="FontAwesome.Icons">FontAwesome Icons<a href="#document-top" title="Go to top"></a></h4> +<a name="FontAwesome-Icons"></a> +<h4>FontAwesome Icons<a href="#document-top" title="Go to top"></a></h4> <p><a href="http://fortawesome.github.io/Font-Awesome/">FontAwesome</a> icons can be used in <a href="#Badges">badges</a> or simply to customize text. <span class="fa-thumbs-up"></span></p> -<h4 id="Notes..tips..warnings..sidebars.and.badges">Notes, tips, warnings, sidebars and badges<a href="#document-top" title="Go to top"></a></h4> +<a name="Notes,-tips,-warnings,-sidebars-and-badges"></a> +<h4>Notes, tips, warnings, sidebars and badges<a href="#document-top" title="Go to top"></a></h4> <div class="sidebar"><p>About notes etc.</p>

@@ -238,37 +249,42 @@ <p>HastyScribe has built-in <a href="#Tips">tips</a>, <a href="#Notes">notes</a>, <a href="#Warnings">warnings</a>, <a href="#Sidebars">sidebars</a>, like this one.</p></div>

<p><span class="draftcomment">&hellip;and this is a comment badge.</span></p> -<h4 id="Responsive.Design">Responsive Design<a href="#document-top" title="Go to top"></a></h4> +<a name="Responsive-Design"></a> +<h4>Responsive Design<a href="#document-top" title="Go to top"></a></h4> <p>All HTML documents created by HastyScribe are responsive and can be viewed perfectly on small devices.</p> -<h4 id="Printed.Media.Support">Printed Media Support<a href="#document-top" title="Go to top"></a></h4> +<a name="Printed-Media-Support"></a> +<h4>Printed Media Support<a href="#document-top" title="Go to top"></a></h4> <p>HastyScribe&rsquo;s stylesheet contains styles that are specific for printed media. This means that if you try to print an HTML file generated by HastyScribe it will paginate properly and it will display headers and footers (with page numbers).</p> -<h2 id="Getting.Started">Getting Started<a href="#document-top" title="Go to top"></a></h2> +<a name="Getting-Started"></a> +<h2>Getting Started<a href="#document-top" title="Go to top"></a></h2> -<h3 id="Downloading.Pre-built.Binaries">Downloading Pre-built Binaries<a href="#document-top" title="Go to top"></a></h3> +<a name="Downloading-Pre-built-Binaries"></a> +<h3>Downloading Pre-built Binaries<a href="#document-top" title="Go to top"></a></h3> <p>The easiest way to get HastyScribe is by downloading one of the prebuilt binaries from the <a href="https://github.com/h3rald/hastyscribe/releases/download/v">Github Release Page</a>:</p> <ul> <li><a href="https://github.com/h3rald/hastyscribe/releases/download/v1.4.0/hastyscribe_v1.4.0_macos_x64.zip">HastyScribe for Mac OS X (x64)</a> &ndash; Compiled on Mac OS X Sierra (LLVM CLANG 8.0.0)</li> <li><a href="https://github.com/h3rald/hastyscribe/releases/download/v1.4.0/hastyscribe_v1.4.0_windows_x64.zip">HastyScribe for Windows (x64)</a> &ndash; Cross-compiled on Mac OS X Sierra (MinGW-w64 GCC 4.8.2)</li> -<li><a href="https://github.com/h3rald/hastyscribe/releases/download/v1.4.0/hastyscribe_v1.4.0_windows_x86.zip">HastyScribe for Windows (x86)</a> &ndash; Cross-compiled on Mac OS X Sierra (MinGW-w64 GCC 4.8.2)</li> <li><a href="https://github.com/h3rald/hastyscribe/releases/download/v1.4.0/hastyscribe_v1.4.0_linux_x64.zip">HastyScribe for Linux (x64)</a> &ndash; Cross-compiled on Mac OS X Sierra (GNU GCC 4.8.1)</li> <li><a href="https://github.com/h3rald/hastyscribe/releases/download/v1.4.0/hastyscribe_v1.4.0_linux_x86.zip">HastyScribe for Linux (x86)</a> &ndash; Cross-compiled on Mac OS X Sierra (GNU GCC 4.8.1)</li> <li><a href="https://github.com/h3rald/hastyscribe/releases/download/v1.4.0/hastyscribe_v1.4.0_linux_arm.zip">HastyScribe for Linux (ARM)</a> &ndash; Cross-compiled on Mac OS X Sierra (GNU GCC 4.8.2)</li> </ul> -<h3 id="Installing.using.Nimble">Installing using Nimble<a href="#document-top" title="Go to top"></a></h3> +<a name="Installing-using-Nimble"></a> +<h3>Installing using Nimble<a href="#document-top" title="Go to top"></a></h3> <p>If you already have <a href="http://nim-lang.org/">Nim</a> installed on your computer, you can simply run</p> <p><span class="cmd">nimble install hastyscribe</span></p> -<h3 id="Building.from.Source">Building from Source<a href="#document-top" title="Go to top"></a></h3> +<a name="Building-from-Source"></a> +<h3>Building from Source<a href="#document-top" title="Go to top"></a></h3> <p>You can also build HastyScribe from source, if there is no pre-built binary for your platform.</p>

@@ -300,11 +316,13 @@ <li>Run <span class="cmd">nim c hastyscribe.nim</span></li>

</ol> -<h2 id="Usage">Usage<a href="#document-top" title="Go to top"></a></h2> +<a name="Usage"></a> +<h2>Usage<a href="#document-top" title="Go to top"></a></h2> <p>HastyScribe is a command-line application that can compile one or more Markdown files into one or more HTML files with the same name(s).</p> -<h3 id="Command.Line.Syntax">Command Line Syntax<a href="#document-top" title="Go to top"></a></h3> +<a name="Command-Line-Syntax"></a> +<h3>Command Line Syntax<a href="#document-top" title="Go to top"></a></h3> <p><span class="cmd">hastyscribe</span> <em>filename-or-glob-expression</em> <strong>[</strong> <span class="opt"><em>&lt;options></em></span> <strong>]</strong></p>

@@ -326,7 +344,8 @@ </li>

</ul> -<h3 id="Linux.OSX.Examples">Linux/OSX Examples<a href="#document-top" title="Go to top"></a></h3> +<a name="Linux/OSX-Examples"></a> +<h3>Linux/OSX Examples<a href="#document-top" title="Go to top"></a></h3> <p>Executing HastyScribe to compile <span class="file">my_markdown_file.md</span> within the current directory:</p>

@@ -336,7 +355,8 @@ <p>Executing HastyScribe to compile all <span class="ext">.md</span> files within the current directory:</p>

<div class="terminal"><p>./hastyscribe *.md</p></div> -<h3 id="Windows.Examples">Windows Examples<a href="#document-top" title="Go to top"></a></h3> +<a name="Windows-Examples"></a> +<h3>Windows Examples<a href="#document-top" title="Go to top"></a></h3> <p>Executing HastyScribe to compile <span class="file">my_markdown_file.md</span> within the current directory:</p>

@@ -350,9 +370,11 @@ <div class="tip"><p>Tip</p>

<p>You can also drag a Markdown file directly on <span class="kwd">hastyscribe.exe</span> to compile it to HTML.</p></div> -<h2 id="Syntax.Reference">Syntax Reference<a href="#document-top" title="Go to top"></a></h2> +<a name="Syntax-Reference"></a> +<h2>Syntax Reference<a href="#document-top" title="Go to top"></a></h2> -<h3 id="Document.Headers">Document Headers<a href="#document-top" title="Go to top"></a></h3> +<a name="Document-Headers"></a> +<h3>Document Headers<a href="#document-top" title="Go to top"></a></h3> <p>HastyScribe supports <a href="http://johnmacfarlane.net/pandoc/">Pandoc</a>-style Document Headers, as implemented by the <a href="http://www.pell.portland.or.us/~orc/Code/discount/">Discount</a> library. Basically, you can specify the title of the document, author and date as the first three lines of the document, prepending each with a <span class="kwd">%</span>, like this</p>

@@ -369,7 +391,8 @@ <li>If you want to use the current date, enter <span class="kwd">% -</span> in the third line.</li>

</ul> </div> -<h3 id="Snippets">Snippets<a href="#document-top" title="Go to top"></a></h3> +<a name="Snippets"></a> +<h3>Snippets<a href="#document-top" title="Go to top"></a></h3> <p>If you want to reuse a few words or even entire blocks of texts, you can use HastyScribe&rsquo;s snippets.</p>

@@ -389,7 +412,8 @@ <li>When a document is compiled, both snippets <em>and snippets definitions</em> are evaluated their body text.</li>

</ul> </div> -<h3 id="Fields">Fields<a href="#document-top" title="Go to top"></a></h3> +<a name="Fields"></a> +<h3>Fields<a href="#document-top" title="Go to top"></a></h3> <p>Besides user-defined snippets, HastyScribe also support fields, which can be used to insert current time and date information in a variety of formats:</p>

@@ -403,91 +427,87 @@ </thead>

<tbody> <tr> <td><code>{{$timestamp}}</code> </td> -<td> 1477225576</td> +<td> 1487428968</td> </tr> <tr> <td><code>{{$date}}</code> </td> -<td> 2016-10-23</td> +<td> 2017-02-18</td> </tr> <tr> <td><code>{{$full-date}}</code> </td> -<td> Sunday, October 23, 2016</td> +<td> Saturday, February 18, 2017</td> </tr> <tr> <td><code>{{$long-date}}</code> </td> -<td> October 23, 2016</td> +<td> February 18, 2017</td> </tr> <tr> <td><code>{{$medium-date}}</code> </td> -<td> Oct 23, 2016</td> +<td> Feb 18, 2017</td> </tr> <tr> <td><code>{{$short-date}}</code> </td> -<td> 10/23/16</td> +<td> 2/18/17</td> </tr> <tr> <td><code>{{$short-time}}</code> </td> -<td> 14:26 PM</td> +<td> 15:42 PM</td> </tr> <tr> <td><code>{{$short-time-24}}</code> </td> -<td> 14:26</td> +<td> 15:42</td> </tr> <tr> <td><code>{{$time}}</code> </td> -<td> 14:26:16 PM</td> +<td> 15:42:48 PM</td> </tr> <tr> <td><code>{{$time-24}}</code> </td> -<td> 14:26:16</td> +<td> 15:42:48</td> </tr> <tr> <td><code>{{$day}}</code> </td> -<td> 23</td> +<td> 18</td> </tr> <tr> <td><code>{{$short-day}}</code> </td> -<td> 23</td> +<td> 18</td> </tr> <tr> <td><code>{{$month}}</code> </td> -<td> 10</td> +<td> 02</td> </tr> <tr> <td><code>{{$short-month}}</code> </td> -<td> 10</td> +<td> 2</td> </tr> <tr> <td><code>{{$year}}</code> </td> -<td> 2016</td> +<td> 2017</td> </tr> <tr> <td><code>{{$short-year}}</code> </td> -<td> 16</td> +<td> 17</td> </tr> <tr> <td><code>{{$weekday}}</code> </td> -<td> Sunday</td> +<td> Saturday</td> </tr> <tr> <td><code>{{$weekday-abbr}}</code> </td> -<td> 23</td> +<td> 18</td> </tr> <tr> <td><code>{{$month-name}}</code> </td> -<td> October</td> +<td> February</td> </tr> <tr> <td><code>{{$month-name-abbr}}</code> </td> -<td> Oct</td> -</tr> -<tr> -<td><code>{{$timezone}}</code> </td> -<td> CEST</td> +<td> Feb</td> </tr> <tr> <td><code>{{$timezone-offset}}</code> </td> -<td> -01:00</td> +<td> +01:00</td> </tr> </tbody> </table>

@@ -499,7 +519,8 @@ <div class="terminal"><p>hastyscribe my-document.md &ndash;field/product:HastyScribe &ndash;field/version:1.2.0</p></div>

<p>In this case it will be possible to access the <span class="kwd">product</span> and <span class="kwd">product</span> fields within <span class="file">my-document.md</span> using <code>{{$product}}</code> and <code>{{$version}}</code>.</p> -<h3 id="Macros">Macros<a href="#document-top" title="Go to top"></a></h3> +<a name="Macros"></a> +<h3>Macros<a href="#document-top" title="Go to top"></a></h3> <p>If snippets are not enough, and you want to reuse chunks of <em>similar</em> content, you can define substitution macros using the following syntax:</p>

@@ -518,7 +539,8 @@ <li>You can use snippets and fields within macros (but you cannot nest macros inside other macros).</li>

</ul> </div> -<h3 id="Inline.Formatting">Inline Formatting<a href="#document-top" title="Go to top"></a></h3> +<a name="Inline-Formatting"></a> +<h3>Inline Formatting<a href="#document-top" title="Go to top"></a></h3> <p>The following table lists all the most common ways to format inline text:</p>

@@ -594,7 +616,8 @@ <div class="tip"><p>Tip</p>

<p>The <span class="kwd">kwd</span>, <span class="kwd">opt</span>, <span class="kwd">file</span>, <span class="kwd">dir</span>, <span class="kwd">arg</span>, <span class="kwd">tt</span> and <span class="kwd">cmd</span> classes are all rendered as inline monospace text. <span class="kwd">kwd</span> and <span class="ext">ext</span> are also rendered in bold.</p></div> -<h4 id="SmartyPants.Substitutions">SmartyPants Substitutions<a href="#document-top" title="Go to top"></a></h4> +<a name="SmartyPants-Substitutions"></a> +<h4>SmartyPants Substitutions<a href="#document-top" title="Go to top"></a></h4> <p>Special characters can be easily entered using some special character sequences.</p>

@@ -617,7 +640,8 @@ <li><code>A^B</code> becomes A<sup>B</sup>. Complex superscripts can be enclosed in brackets, so <code>A^(B+2)</code> &rarr; A<sup>B+2</sup>.</li>

</ul> -<h4 id="Icons">Icons<a href="#document-top" title="Go to top"></a></h4> +<a name="Icons"></a> +<h4>Icons<a href="#document-top" title="Go to top"></a></h4> <p>HastyScribe bundles the <a href="http://fortawesome.github.io/Font-Awesome/">FontAwesome</a> icon font. To prepend an icon to text you can use Discount&rsquo;s <em>class:</em> pseudo-protocol, and specify a valid <span class="kwd">fa-*</span> (non-alias) class.</p>

@@ -651,7 +675,8 @@ <div class="tip"><p>Tip</p>

<p>See the <a href="http://fortawesome.github.io/Font-Awesome/icons/">FontAwesome Icon Reference</a> for a complete list of all CSS classes to use for icons (aliases are not supported).</p></div> -<h4 id="Badges">Badges<a href="#document-top" title="Go to top"></a></h4> +<a name="Badges"></a> +<h4>Badges<a href="#document-top" title="Go to top"></a></h4> <p>Badges are normally just shorthands for <a href="#Icons">Icons</a> formatted with different colors. To add a <em>badge</em> to some inline text, use the corresponding class among those listed in the following table. For example, the following code:</p>

@@ -888,13 +913,15 @@ </tbody>

</table> </div> -<h4 id="HastyScribe.Logo">HastyScribe Logo<a href="#document-top" title="Go to top"></a></h4> +<a name="HastyScribe-Logo"></a> +<h4>HastyScribe Logo<a href="#document-top" title="Go to top"></a></h4> <p>To display the HastyScribe logo, use the <span class="kwd">hastyscribe</span> class, like this:</p> <p><code>[](class:hastyscribe)</code> &rarr; <span class="hastyscribe"></span></p> -<h4 id="Links">Links<a href="#document-top" title="Go to top"></a></h4> +<a name="Links"></a> +<h4>Links<a href="#document-top" title="Go to top"></a></h4> <div class="responsive"><table> <thead>

@@ -939,9 +966,11 @@ <li><a href="http://it.linkedin.com/in/fabiocevasco">fabiocevasco</a></li>

</ul> </div> -<h3 id="Block-level.Formatting">Block-level Formatting<a href="#document-top" title="Go to top"></a></h3> +<a name="Block-level-Formatting"></a> +<h3>Block-level Formatting<a href="#document-top" title="Go to top"></a></h3> -<h4 id="Headings">Headings<a href="#document-top" title="Go to top"></a></h4> +<a name="Headings"></a> +<h4>Headings<a href="#document-top" title="Go to top"></a></h4> <p>Headings can be specified simply by prepending <span class="kwd">#</span>s to text, as follows:</p>

@@ -957,7 +986,8 @@ <div class="note"><p>Note</p>

<p>If you use <a href="#Document.Headers">Document Headers</a>, A <span class="kwd">H1</span> is used for the title of the HastyScribe document. Within the document, start using headings from <span class="kwd">H2</span>.</p></div> -<h4 id="Tables">Tables<a href="#document-top" title="Go to top"></a></h4> +<a name="Tables"></a> +<h4>Tables<a href="#document-top" title="Go to top"></a></h4> <p>HastyScribe supports <a href="http://michelf.com/projects/php-markdown/extra/">PHP Markdown Extra</a> table syntax using pipes and dashes.</p>

@@ -1008,7 +1038,8 @@ <div class="sidebar"><p>Responsive Tables</p>

<p>To make tables responsive, put them in a <em>responsive</em> block, like in the previous example. The <span class="kwd">responsive</span> class causes a table not to shrink and makes it scrollable horizontally on small devices.</p></div> -<h4 id="Block.Quotes">Block Quotes<a href="#document-top" title="Go to top"></a></h4> +<a name="Block-Quotes"></a> +<h4>Block Quotes<a href="#document-top" title="Go to top"></a></h4> <p>Block quotes can be created simply by prepending a <span class="kwd">></span> to a line, and they can be nested by prepending additional <span class="kwd">></span>s.</p>

@@ -1024,7 +1055,8 @@ <blockquote><p>This is a block quote.</p>

<blockquote><p>This is a nested quote.</p></blockquote></blockquote> -<h4 id="Code.Blocks">Code Blocks<a href="#document-top" title="Go to top"></a></h4> +<a name="Code-Blocks"></a> +<h4>Code Blocks<a href="#document-top" title="Go to top"></a></h4> <p>To format a block of source code, indent it by at least four spaces. Here&rsquo;s the result:</p>

@@ -1043,7 +1075,8 @@ <div class="warning"><p>Warning</p>

<p>HastyScribe does not support syntax highlighting for code blocks. To do so, it would require Javascript and HastyScribe is currently kept purposedly &ldquo;Javascript-free&rdquo;.</p></div> -<h4 id="Images">Images<a href="#document-top" title="Go to top"></a></h4> +<a name="Images"></a> +<h4>Images<a href="#document-top" title="Go to top"></a></h4> <p>The following HastyScribe Markdown code:</p>

@@ -1071,9 +1104,11 @@

<p>If HastyScribe is unable to download an image, it will leave it linked.</p></div> -<h4 id="Lists">Lists<a href="#document-top" title="Go to top"></a></h4> +<a name="Lists"></a> +<h4>Lists<a href="#document-top" title="Go to top"></a></h4> -<h5 id="Unordered.Lists">Unordered Lists<a href="#document-top" title="Go to top"></a></h5> +<a name="Unordered-Lists"></a> +<h5>Unordered Lists<a href="#document-top" title="Go to top"></a></h5> <p>The following HastyScribe Markdown code:</p>

@@ -1091,7 +1126,8 @@ <li>And another&hellip;</li>

</ul> -<h5 id="Ordered.Lists">Ordered Lists<a href="#document-top" title="Go to top"></a></h5> +<a name="Ordered-Lists"></a> +<h5>Ordered Lists<a href="#document-top" title="Go to top"></a></h5> <p>The following HastyScribe Markdown code:</p>

@@ -1113,7 +1149,8 @@ <div class="tip"><p>Tip</p>

<p>You don&rsquo;t have to write numbers in order &ndash; any number followed by a dot will do.</p></div> -<h5 id="Alphabetical.Lists">Alphabetical Lists<a href="#document-top" title="Go to top"></a></h5> +<a name="Alphabetical-Lists"></a> +<h5>Alphabetical Lists<a href="#document-top" title="Go to top"></a></h5> <p>The following HastyScribe Markdown code:</p>

@@ -1135,7 +1172,8 @@ <div class="tip"><p>Tip</p>

<p>You don&rsquo;t have to write letters in order &ndash; any letter followed by a dot will do.</p></div> -<h5 id="Unstyled.Lists">Unstyled Lists<a href="#document-top" title="Go to top"></a></h5> +<a name="Unstyled-Lists"></a> +<h5>Unstyled Lists<a href="#document-top" title="Go to top"></a></h5> <p>The following HastyScribe Markdown code:</p>

@@ -1154,7 +1192,8 @@ <li>And another&hellip;</li>

</ul> </div> -<h5 id="Nested.Lists">Nested Lists<a href="#document-top" title="Go to top"></a></h5> +<a name="Nested-Lists"></a> +<h5>Nested Lists<a href="#document-top" title="Go to top"></a></h5> <p>To create a list within a list, simply indent the whole nested list with four space.</p>

@@ -1190,7 +1229,8 @@ </li>

</ul> -<h5 id="Definition.Lists">Definition Lists<a href="#document-top" title="Go to top"></a></h5> +<a name="Definition-Lists"></a> +<h5>Definition Lists<a href="#document-top" title="Go to top"></a></h5> <p>In some cases you may want to write a list of terms and their corresponding definitions. You could use an ordinary unordered list, but semantically speaking the <em>proper</em> type of list to use in this case is a definition list.</p>

@@ -1234,9 +1274,11 @@ =definition list=

A list of terms and definitions. </code></pre> -<h4 id="Class.Blocks">Class Blocks<a href="#document-top" title="Go to top"></a></h4> +<a name="Class-Blocks"></a> +<h4>Class Blocks<a href="#document-top" title="Go to top"></a></h4> -<h5 id="Notes">Notes<a href="#document-top" title="Go to top"></a></h5> +<a name="Notes"></a> +<h5>Notes<a href="#document-top" title="Go to top"></a></h5> <p><a href="http://www.pell.portland.or.us/~orc/Code/discount/">Discount</a> supports the definition of <em>class blocks</em>: <span class="kwd">div</span>s with a class attribute. The syntax is very similar to the one used for <a href="#Block.Quotes">block quotes</a>, with the addition of the class name wrapped in <span class="kwd">%</span>s on the first line.</p>

@@ -1256,7 +1298,8 @@ <div class="note"><p>Note</p>

<p>This is a note.</p></div> -<h5 id="Tips">Tips<a href="#document-top" title="Go to top"></a></h5> +<a name="Tips"></a> +<h5>Tips<a href="#document-top" title="Go to top"></a></h5> <p>Tips are used for optional information that can help the user in some way.</p>

@@ -1274,7 +1317,8 @@ <div class="tip"><p>Tip</p>

<p>This is a tip.</p></div> -<h5 id="Warnings">Warnings<a href="#document-top" title="Go to top"></a></h5> +<a name="Warnings"></a> +<h5>Warnings<a href="#document-top" title="Go to top"></a></h5> <p>Warnings are used for important information the user should not overlook.</p>

@@ -1292,7 +1336,8 @@ <div class="warning"><p>Warning</p>

<p>This is a warning or an important note.</p></div> -<h5 id="Sidebars">Sidebars<a href="#document-top" title="Go to top"></a></h5> +<a name="Sidebars"></a> +<h5>Sidebars<a href="#document-top" title="Go to top"></a></h5> <p>Sidebars are used for digressions and asides.</p>

@@ -1311,7 +1356,8 @@ <div class="sidebar"><p>This is a <em>sidebar</em></p>

<p>Although not always placed on the side of the page, <em>sidebars</em> contain additional content and asides.</p></div> -<h5 id="Terminal.Sessions">Terminal Sessions<a href="#document-top" title="Go to top"></a></h5> +<a name="Terminal-Sessions"></a> +<h5>Terminal Sessions<a href="#document-top" title="Go to top"></a></h5> <p>Terminal sessions are used to display commands entered in a terminal, in sequence, without displaying their output.</p>

@@ -1347,7 +1393,8 @@ <p>Produces the following output:</p>

<div class="terminal-su"><p>shutdown -h now</p></div> -<h2 id="Credits">Credits<a href="#document-top" title="Go to top"></a></h2> +<a name="Credits"></a> +<h2>Credits<a href="#document-top" title="Go to top"></a></h2> <p>HastyScribe is powered by the following open source software (see <a href="https://github.com/h3rald/hastyscribe/blob/master/LICENSE.md">LICENSE.md</a> for licensing details):</p>

@@ -1371,7 +1418,7 @@

<p style="text-align:center;"> <img src="data:image/png;base64,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" alt="Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Unported License" /></p> </div> <div id="footer"> - <p><span class="copy"></span> Fabio Cevasco &ndash; October 23, 2016</p> + <p><span class="copy"></span> Fabio Cevasco &ndash; February 18, 2017</p> <p><span>Powered by</span> <a href="https://h3rald.com/hastyscribe"><span class="hastyscribe"></span></a></p> </div> </div>
M doc/HastyScribe_UserGuide.mddoc/HastyScribe_UserGuide.md

@@ -90,7 +90,6 @@ The easiest way to get {{hs}} is by downloading one of the prebuilt binaries from the [Github Release Page][release]:

* {#release||Mac OS X (x64)||macos_x64||Compiled on {{osx -> Mac OS X Sierra}} (LLVM CLANG 8.0.0)#} * {#release||Windows (x64)||windows_x64||{{xcc -> Cross-compiled on}} {{osx}} (MinGW-w64 GCC 4.8.2)#} - * {#release||Windows (x86)||windows_x86||{{xcc}} {{osx}} (MinGW-w64 GCC 4.8.2)#} * {#release||Linux (x64)||linux_x64||{{xcc}} {{osx}} (GNU GCC 4.8.1)#} * {#release||Linux (x86)||linux_x86||{{xcc}} {{osx}} (GNU GCC 4.8.1)#} * {#release||Linux (ARM)||linux_arm||{{xcc}} {{osx}} (GNU GCC 4.8.2)#}

@@ -241,7 +240,6 @@ > <code>\{\{$weekday\}\}</code> | {{$weekday}}

> <code>\{\{$weekday-abbr\}\}</code> | {{$weekday-abbr}} > <code>\{\{$month-name\}\}</code> | {{$month-name}} > <code>\{\{$month-name-abbr\}\}</code> | {{$month-name-abbr}} -> <code>\{\{$timezone\}\}</code> | {{$timezone}} > <code>\{\{$timezone-offset\}\}</code> | {{$timezone-offset}} Additionally, you can define your own custom fields via command-line parameters, using the [--field/](class:arg) dynamic parameter, like this:
M hastyscribe.nimhastyscribe.nim

@@ -82,8 +82,6 @@ result["month-name-abbr"] = proc():string =

return now.format("MMM") result["timezone-offset"] = proc():string = return now.format("zzz") - result["timezone"] = proc():string = - return now.format("ZZZ") proc newHastyScribe*(options: HastyOptions, fields: HastyFields): HastyScribe = return HastyScribe(options: options, fields: initFields(fields), snippets: initTable[string, string](), macros: initTable[string, string](), document: "")

@@ -265,7 +263,7 @@ header_tag = ""

toc = "" metadata = TMDMetaData(title:"", author:"", date:"", toc:"", css:"") # Process markdown - hs.document = hs.document.md(MKD_DOTOC or MKD_EXTRA_FOOTNOTE, metadata) + hs.document = hs.document.md(0, metadata) # Manage metadata if metadata.author != "": author_footer = "<span class=\"copy\"></span> " & metadata.author & " &ndash;"
M hastyscribe.nim.cfghastyscribe.nim.cfg

@@ -1,5 +1,3 @@

-define:release - # https://gist.github.com/Drakulix/9881160 amd64.windows.gcc.path = "/usr/local/mingw/bin" amd64.windows.gcc.exe = "x86_64-w64-mingw32-gcc"
M markdown.nimmarkdown.nim

@@ -1,127 +1,121 @@

-import strutils - +const + MKDIO_D* = true type MMIOT* = int - mkd_flag_t* = uint32 + mkd_flag_t* = cuint +{.push importc, cdecl.} # line builder for markdown() # -{.push importc, cdecl.} -proc mkd_in*(a2: File; a3: mkd_flag_t): ptr MMIOT +proc mkd_in*(a2: ptr FILE; a3: mkd_flag_t): ptr MMIOT # assemble input from a file - proc mkd_string*(a2: cstring; a3: cint; a4: mkd_flag_t): ptr MMIOT # assemble input from a buffer # line builder for github flavoured markdown # - -proc gfm_in*(a2: File; a3: mkd_flag_t): ptr MMIOT +proc gfm_in*(a2: ptr FILE; a3: mkd_flag_t): ptr MMIOT # assemble input from a file - proc gfm_string*(a2: cstring; a3: cint; a4: mkd_flag_t): ptr MMIOT # assemble input from a buffer - proc mkd_basename*(a2: ptr MMIOT; a3: cstring) proc mkd_initialize*() proc mkd_with_html5_tags*() proc mkd_shlib_destructor*() # compilation, debugging, cleanup # - proc mkd_compile*(a2: ptr MMIOT; a3: mkd_flag_t): cint proc mkd_cleanup*(a2: ptr MMIOT) # markup functions # - -proc mkd_dump*(a2: ptr MMIOT; a3: File; a4: cint; a5: cstring): cint -proc markdown*(a2: ptr MMIOT; a3: File; a4: mkd_flag_t): cint +proc mkd_dump*(a2: ptr MMIOT; a3: ptr FILE; a4: cint; a5: cstring): cint +proc markdown*(a2: ptr MMIOT; a3: ptr FILE; a4: mkd_flag_t): cint proc mkd_line*(a2: cstring; a3: cint; a4: cstringArray; a5: mkd_flag_t): cint type mkd_sta_function_t* = proc (a2: cint; a3: pointer): cint - proc mkd_string_to_anchor*(a2: cstring; a3: cint; a4: mkd_sta_function_t; a5: pointer; a6: cint) -proc mkd_xhtmlpage*(a2: ptr MMIOT; a3: cint; a4: File): cint +proc mkd_xhtmlpage*(a2: ptr MMIOT; a3: cint; a4: ptr FILE): cint # header block access # - proc mkd_doc_title*(a2: ptr MMIOT): cstring proc mkd_doc_author*(a2: ptr MMIOT): cstring proc mkd_doc_date*(a2: ptr MMIOT): cstring # compiled data access # - proc mkd_document*(a2: ptr MMIOT; a3: cstringArray): cint proc mkd_toc*(a2: ptr MMIOT; a3: cstringArray): cint proc mkd_css*(a2: ptr MMIOT; a3: cstringArray): cint proc mkd_xml*(a2: cstring; a3: cint; a4: cstringArray): cint # write-to-file functions # - -proc mkd_generatehtml*(a2: ptr MMIOT; a3: File): cint -proc mkd_generatetoc*(a2: ptr MMIOT; a3: File): cint -proc mkd_generatexml*(a2: cstring; a3: cint; a4: File): cint -proc mkd_generatecss*(a2: ptr MMIOT; a3: File): cint +proc mkd_generatehtml*(a2: ptr MMIOT; a3: ptr FILE): cint +proc mkd_generatetoc*(a2: ptr MMIOT; a3: ptr FILE): cint +proc mkd_generatexml*(a2: cstring; a3: cint; a4: ptr FILE): cint +proc mkd_generatecss*(a2: ptr MMIOT; a3: ptr FILE): cint const mkd_style* = mkd_generatecss - -proc mkd_generateline*(a2: cstring; a3: cint; a4: File; a5: mkd_flag_t): cint +proc mkd_generateline*(a2: cstring; a3: cint; a4: ptr FILE; a5: mkd_flag_t): cint const mkd_text* = mkd_generateline - # url generator callbacks # - type mkd_callback_t* = proc (a2: cstring; a3: cint; a4: pointer): cstring mkd_free_t* = proc (a2: cstring; a3: pointer) - proc mkd_e_url*(a2: pointer; a3: mkd_callback_t) proc mkd_e_flags*(a2: pointer; a3: mkd_callback_t) proc mkd_e_free*(a2: pointer; a3: mkd_free_t) proc mkd_e_data*(a2: pointer; a3: pointer) # version#. # - var markdown_version*: ptr char - -proc mkd_mmiot_flags*(a2: File; a3: ptr MMIOT; a4: cint) -proc mkd_flags_are*(a2: File; a3: mkd_flag_t; a4: cint) +proc mkd_mmiot_flags*(a2: ptr FILE; a3: ptr MMIOT; a4: cint) +proc mkd_flags_are*(a2: ptr FILE; a3: mkd_flag_t; a4: cint) proc mkd_ref_prefix*(a2: ptr MMIOT; a3: cstring) -# special flags for markdown() and mkd_text() -# - {.pop.} +# special flags for markdown() and mkd_text() +# const - MKD_NOLINKS* = 0x00000001 # don't do link processing, block <a> tags - MKD_NOIMAGE* = 0x00000002 # don't do image processing, block <img> - MKD_NOPANTS* = 0x00000004 # don't run smartypants() - MKD_NOHTML* = 0x00000008 # don't allow raw html through AT ALL - MKD_STRICT* = 0x00000010 # disable SUPERSCRIPT, RELAXED_EMPHASIS - MKD_TAGTEXT* = 0x00000020 # process text inside an html tag; no - # <em>, no <bold>, no html or [] expansion - MKD_NO_EXT* = 0x00000040 # don't allow pseudo-protocols - #MKD_NOEXT* = MKD_NO_EXT # ^^^ (aliased for user convenience) - MKD_CDATA* = 0x00000080 # generate code for xml ![CDATA[...]] - MKD_NOSUPERSCRIPT* = 0x00000100 # no A^B - MKD_NORELAXED* = 0x00000200 # emphasis happens /everywhere/ - MKD_NOTABLES* = 0x00000400 # disallow tables - MKD_NOSTRIKETHROUGH* = 0x00000800 # forbid ~~strikethrough~~ - MKD_DOTOC* = 0x00001000 # do table-of-contents processing - MKD_1_COMPAT* = 0x00002000 # compatibility with MarkdownTest_1.0 - MKD_AUTOLINK* = 0x00004000 # make http://foo.com link even without <>s - MKD_SAFELINK* = 0x00008000 # paranoid check for link protocol - MKD_NOHEADER* = 0x00010000 # don't process header blocks - MKD_TABSTOP* = 0x00020000 # expand tabs to 4 spaces - MKD_NODIVQUOTE* = 0x00040000 # forbid >%class% blocks - MKD_NOALPHALIST* = 0x00080000 # forbid alphabetic lists - MKD_NODLIST* = 0x00100000 # forbid definition lists - MKD_EXTRA_FOOTNOTE* = 0x00200000 # enable markdown extra-style footnotes - MKD_NOSTYLE* = 0x00400000 # don't extract <style> blocks + MKD_NOLINKS* = 0x00000001 + MKD_NOIMAGE* = 0x00000002 + MKD_NOPANTS* = 0x00000004 + MKD_NOHTML* = 0x00000008 + MKD_STRICT* = 0x00000010 + MKD_TAGTEXT* = 0x00000020 + MKD_NO_EXT* = 0x00000040 + MKD_CDATA* = 0x00000080 + MKD_NOSUPERSCRIPT* = 0x00000100 + MKD_NORELAXED* = 0x00000200 + MKD_NOTABLES* = 0x00000400 + MKD_NOSTRIKETHROUGH* = 0x00000800 + MKD_TOC* = 0x00001000 + MKD_1_COMPAT* = 0x00002000 + MKD_AUTOLINK* = 0x00004000 + MKD_SAFELINK* = 0x00008000 + MKD_NOHEADER* = 0x00010000 + MKD_TABSTOP* = 0x00020000 + MKD_NODIVQUOTE* = 0x00040000 + MKD_NOALPHALIST* = 0x00080000 + MKD_NODLIST* = 0x00100000 + MKD_EXTRA_FOOTNOTE* = 0x00200000 + MKD_NOSTYLE* = 0x00400000 + MKD_NODLDISCOUNT* = 0x00800000 + MKD_DLEXTRA* = 0x01000000 + MKD_FENCEDCODE* = 0x02000000 + MKD_IDANCHOR* = 0x04000000 + MKD_GITHUBTAGS* = 0x08000000 + MKD_URLENCODEDANCHOR* = 0x10000000 + MKD_HTML5ANCHOR* = 0x10000000 + MKD_LATEX* = 0x40000000 MKD_EMBED* = MKD_NOLINKS or MKD_NOIMAGE or MKD_TAGTEXT -# special flags for mkd_in() and mkd_string() +## High Level API + +import strutils + +const + DefaultFlags = MKD_TOC or MKD_1_COMPAT or MKD_EXTRA_FOOTNOTE or MKD_DLEXTRA or MKD_FENCEDCODE or MKD_GITHUBTAGS or MKD_HTML5ANCHOR or MKD_LATEX type TMDMetaData* = object title*: string

@@ -131,7 +125,11 @@ toc*: string

css*: string proc md*(s: string, f = 0): string = - var flags = uint32(f) + var flags: uint32 + if (f == 0): + flags = DefaultFlags + else: + flags = uint32(f) var str = cstring(s&" ") var mmiot = mkd_string(str, cint(str.len-1), flags) discard mkd_compile(mmiot, flags)

@@ -142,7 +140,11 @@ mkd_cleanup(mmiot)

return proc md*(s: string, f = 0, data: var TMDMetadata): string = - var flags = uint32(f) + var flags: uint32 + if (f == 0): + flags = DefaultFlags + else: + flags = uint32(f) # Check if metadata is present var lns = s.splitLines var valid_metadata = false

@@ -163,7 +165,7 @@ data.author = $mkd_doc_author(mmiot)

data.date = $mkd_doc_date(mmiot) discard mkd_compile(mmiot, flags) # Process TOC - if (int(flags) and MKD_DOTOC) == MKD_DOTOC: + if (int(flags) and MKD_TOC) == MKD_TOC: var toc = allocCStringArray(@[""]) if mkd_toc(mmiot, toc) > 0: data.toc = cstringArrayToSeq(toc)[0]