Glyph - Links and Bookmarks

Lightweight markups let you create internal and external links in a very easy way, and you can still do so in Glyph. However, if you do so:

  • you can’t check if they are valid
  • you can’t infer the link title automatically

If you care about link validation and you want to save some keystrokes, then you should use:

  • the link macro (aliased to =>) — to create internal and external links.
  • the anchor macro (aliased to #) — to create named anchors (bookmarks) within your document.

Basically, if you use the link macro and the anchor macro, Glyph makes sure that:

  • all links point to valid anchors within the document (regardless if the anchors are before or after the link, in snippets or included files).
  • there are no duplicate anchors within the documents.
  • if no title is specified as second parameter for the link macro, the anchor’s name is used as such.

Besides using the anchor macro, you can also create an anchor for a header by passing an @id attribute the the section macro, like this:

1section[
2  @title[My Section]
3  @id[my_section]
4...
5]

By default, validation is only enabled for internal links (i.e. the check occurs if the first parameter of the link macro starts with a #). You can enable it for external links as well by setting the options.url_validation setting to true. If URL validation is enabled, an error is returned if a link returns an HTTP status greater than 302.