Sha256: 5f865e2aa6dc3c3cb7ad1c029cca66dddb01f3a3ab632dc6d2c701e63fd0b070

Contents?: true

Size: 1.32 KB

Versions: 2

Compression:

Stored size: 1.32 KB

Contents

	p[Glyph documents are normally organized as a hierarchical tree of nested chapters, appendixes, sections, etc. To define a section, use the %>[section], like so:]

	highlight[=html|
section[
  @title[Section #1]
Write the section contents here...
  section[
    @title[Section #2]
This section is nested into the previous one.
  ] --[End of Section #2]
] --[End of Section #1]
	=]

	txt[This example defines two nested sections. If the code[@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]).

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:]

	highlight[=html|
<div class="section">
  <h2>Section #1</h2>
  <p>Write the section contents here...</p>
  <div class="section">
    <h3>Section #2</h3>
    <p>This section is nested in the previous one</p>
  </div>
</div>
	=]

	txt[
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).
	]

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
glyph-0.4.1 book/text/text_editing/sections.glyph
glyph-0.4.0 book/text/text_editing/sections.glyph