Glyph - Content Reuse

File inclusions

If you’re authoring a user manual, a long article, or a book, writing everything inside a single document.glyph file may not be optimal. For this reason, Glyph provides an include macro that can be used to include the contents of any file within the text/ directory:


The macro call above loads the contents of the introduction.textile file, within the text/general directory.

When including a text file, an input filter macro is applied to its contents by default, based on the file extension used:

You can override this behavior by setting the filters.by_file_extensions configuration setting to false. If no extension is specified, .glyph is assumed.


  • The include macro can also be used to include (and evaluate) ruby files (with a .rb extension). In this case, the ruby file must be placed within the lib/ directory of the current project.
  • The load macro macro can be used to include the content of any file without performing any evaluation.


While including the context of an entire file is definitely a useful feature for content reuse, sometimes it can be an overkill. What if, for example, you just want to reuse a short procedure or even a sentence or a single word? In this case, you may want to consider using a snippet instead.

Snippets can be defined using the snippet: macro (aliased by &:) and called by using the snippet macro (aliased by &). Consider the following simple example:

1&:[markups|Textile or Markdown]
3Glyph supports &[markups].

You can use &[markups] anywhere in your document instead of having to type "Textile or Markdown" every time. Additionally, later on you can change the value of the markups to change it everywhere else in the document.