Glyph - Macro attributes

Although a macro can take any number of parameters, they are often no more than two or three, for readibility reasons: parameters have no name, but their position within a macro is significant.

If you have something like this:

1custom_image[test.png|50%|50%|Test Image]

it may still be easy enough to understand what each parameter is used for, but:

  • you can easily forget that the third parameter is the image width
  • if you don’t want to resize the image, you still have to pass empty parameters to the macro, like this: custom_image[test2.png|||Test Image]

To avoid these situations, some macros which would normally take three or four parameters take optional attributes instead, so you can write:

1image[test.png
2  @width[50%]
3  @alt[Test Image]
4  @height[50%]
5]

More verbose, of course, but definitely more readable. In this way, if you won't want to scale an image, you can safely omit the @width and @height attributes.