Glyph - Bookmarks and Headers

The Glyph::Macro class also includes a few methods to check and store bookmarks and headers. Consider for example the following source code for the anchor macro:

1macro :anchor do 
2  min_parameters 1
3  max_parameters 2
4  bookmark :id => param(0), :title => param(1), :file => @source_file
5  @data[:id] = param 0
6  @data[:title] = param 1
7  render
8end

The bookmark? method can be used to check the existance of a particular ID within the whole document, while the bookmark method is used to store bookmark IDs and titles. In a similar way, you can use header? and header methods to check the existance of headers within the documents or store new ones.