Mark II

Mark II is a text-to-HTML converter. The syntax it uses closely follows the way it's author formats his plain text documents (e.g. e-mail), so it stays simple and readable.

You can get the latest sources [1] via mercurial like this:

hg clone http://hg.tx97.net/mark-two

The syntax

Headers

Mark II recognizes two styles of headers. Underlined headers:

This is a level 1 header
========================

A level 2 header
----------------

And a level 3 header
~~~~~~~~~~~~~~~~~~~~

And prefixed headers:

= Level 1
== Level 2
=== And so on

Code blocks

A code block is any piece of text indented by 4 spaces (including unindented empty lines between indented parts).

You can also have inline code fragments by enclosing text into one or several single quotes:

Here's an example 'inline code fragment'.

You can also quote the quotes, like this: '' ' ''.

References

A reference id enclosed in square brackets, becomes a link to that reference. You must actually define the reference with the same id somewhere in the text.

References [1] work just as they do
in printed literature.

[1] the-url

A common practice is to gather all the references into one block at the end of the document.

Lists

An indented piece of text started with a minus or an asterisk marks an unordered list:

* you can use both single-line items
* and multi-line items,
  like this one

* note that empty lines do not break lists

An indented piece of text started with a number and a dot or a closing paren marks an ordered list:

1. note that the numbers
9) don't matter

Embedded HTML

A single closed HTML tag placed on it's own line will be placed into the HTML output verbatim:

<img src="some.image"/>

Similarly, multi-line HTML fragments are recognized if the starting and ending tags are located on their own lines:

<script type="text/javascript">
  console.log("Hello, world!");
</script>

Paragraphs

Everything else becomes paragraphs. Use empty lines to delimit them.

The tool

Setup TCL 8.5, get mark-two.tcl, make it executable, pipe text into it or run it with file names as parameters, and collect the HTML from it's output.

References

  1. http://hg.tx97.net/mark-two