Neopolitan - Section And Attribute Tokens
One of the goals with the format is to make it extensible. The way I'm handling that is by making the section types arbitrary and putting the responsibility on the rendering engine to apply the proper template based off the names and attributes.
Section Name Rules - -
The rules for defining a section type are :
-
Must be preceeded by the start of a file or and empty line
-
Must start with two dashes followed by zero or more extra dashes
-
The dashes must be followed by a single space
-
The space must be followed by a single word made up of any UTF - 8 non - whitespace characters
These are all valid section headers
-- alfa
---- bravo
-- c.h.a.r.l.i.e
-- ๐นโโโโ
-- /echo
Section Attribute Types
Section attributes come in two types :
-
boolean
-
key/value
Boolean Section Attributes
The rules for boolean attributes are the same as the section rules with the exception that instead of starting after the start of the file or an empty line, each one must start on a line immediatly following a line that starts a section or a line with another attribute.
Key/Value Section Attributes
Key value attributes work like boolean with the additional properties :
-
The key must end with a [TODO: Code shorthand span ] character
-
The [TODO: Code shorthand span ] must be followed by exactly one space character
-
The value is any text up until the end of the line
An example of a [TODO: Code shorthand span ] section with a [TODO: Code shorthand span ] boolean attribute and [TODO: Code shorthand span ] key/value pair.
-- code
-- rust
-- id: sample_code