Doccy
Doccy is a simple brace based markup language, an alternative to writing HTML for people who enjoy the power and flexibility but do not enjoy writing it.
Syntax
Paragraphs
Any text contained within specific contexts will be treated as one or more paragraphs if separated by two or more line breaks and it contains only inline elements.
Document body
This is a paragraph.
{h1: This is a header.}
And this is another.
Renders as:
This is a paragraph.
This is a header.
And this is another.
Special elements
The following elements also automatically wrap paragraphs: article, aside, blockquote, div, fieldset, footer, form, header, hgroup, main and section.
{blockquote: This is a paragraph.
And this is another.}
Renders as:
This is a paragraph.
And this is another.
Elements
Anything between two curley-braces is considered an element if:
- Immediately following the opening brace, a valid element name is found,
- followed by whitespace or attributes,
- and finaly a colon (
:).
For example, the following are all valid:
{h1:Top-level heading}
{p : A paragraph}
There is one exception to this rule, line breaks (<br>) can be written as:
{br}
Attributes
Anything between the opening curley-brace and colon is considered an attribute if:
- It begins with one of
@,#,%,., - followed by a valid identifier (
[a-zA-Z][a-zA-Z0-9]*) - and optionally a value.
Named Attributes
A named attribute with a value looks like:
{h1 @class main header: Header}
Renders as:
Header
Without a value:
{input @required}
Renders as:
Values containing special characters must be escaped:
{h1 @test Bad characters\: \@\#\%\.\{\}: ...}
Renders as:
...
Data Attributes
A shorthand for data- attributes:
{pre %lang html: ...}
{pre %html: ...}
Renders as:
...
...
As with named attributes, special characters must be escaped.
Class Attributes
A shorthand for class="..." attributes:
{h1.main.header: Header}
Renders as:
Header
Id Attributes
A shorthand for id="..." attributes:
{h1#main: Header}
Renders as:
Header
Usage
Rust
extern crate doccy;
use doccy_to_html;