Glyph documents are normally organized as a hierarchical tree of nested chapters, appendixes, sections, etc. To
define a section, use the section
macro
(aliased by §
), like so:
This example defines two nested sections. If the @title
attribute is specified like in this case, it
will be converted to a proper HTML header and it will appear in the Table of Contents (see
the toc
macro).
Note an important difference from HTML: there is no need for an explicit level for the headers, as it will be determined at runtime when the document is compiled, based on how sections are nested. The previous code snippet (taken as it is), for example, will be transformed into the following HTML code:
By default, in Glyph the first header level is 2, so the two headers are rendered as h2
and
h3
, respectively (--[...]
macros are comments, therefore they are not included in
the final output).
Markup-aware sections
Although Glyph can be used on its own to produce valid HTML or XML code, you may often want to use Textile or Markdown to save some typing. Typically, you’ll end up writing a lot of code like this:
To save you even more typing, you can use the textile_section
macro (aliased by
txt_section
and §txt
) and the markdown_section
macro (aliased
by md_section
and §md
). By doing so, the previous code snippet can be written like this: