NIML is a text oriented markup language, convertible to HTML or XML. NIML's purpose is to be used for documentation and templating, therefore its top objective is to be simple to read and write.
Features:
Example:
html+
head
+title NIML
+link { href: niml.css rel: stylesheet type: text/css }
body+
div+ { class: container }
h1 NIML
p Paragraph
NIML is inspired by ideas from other languages. It's only unique feature (and flaw in the same time) is its element nesting syntax.
Language | Ideas taken to NIML | What's missing? Why NIML makes sense? |
---|---|---|
HTML/XML | markup language | indented, verbose |
TOML | not indented | doesn't handle text that well |
Markdown | text oriented | doesn't help with markup |
HAML/YAML | bracketless tags, no end tags | indented |
Razor | @template syntax | N/A |
NIML | HTML/XML | |
---|---|---|
One liners | h1 This is a title |
<h1>This is a title</h1> |
Multiline text | p < Text in multiple lines should be wrapped in angle brackets. > |
<p>Text in multiple lines should be wrapped in angle brackets.</p> |
Attributes | h2 { id: chapter1 } Chapter 1 |
<h2 id="chapter1">Chapter 1</h2> |
Nesting elements | html+ head +title Title body+ h1 Header +small Extra p Paragraph |
<html> <head> <title>Title</title> </head> <body> <h1>Header<small>Extra</small><h1> <p>Paragraph</p> </body> </html> |
Quotes | pre <" <a href=""#"">Link</a> "> |
<pre> <a href="#">Link</a> </pre> |
Scripts | +script <: //This will not be HTML encoded. $(function() { ... }) > |
<script> //This will not be HTML encoded. $(function() { ... }) </script> |
One line, multiple elements | table+ tr+ | th X | th Y |- tr+ | td x | td y |- - |
<table> <tr> <th>X</th> <th>Y</th> </tr> <tr> <td>x</td> <td>y</td> </tr> </table> |
Mixing text and elements | p < This a text containing a <a { href:# } link />. > |
<p>This a text containing a <a href="#">link</a>.</p> |
Templating | @for (var i = 0; i<10; i++) {@ +li @i } |