Snippets and Snippet Sets
Purpose
TypeMetal’s customizable “snippet sets” help you leverage the full potential of modern HTML to produce beautifully and flexibly styled, and consistently and semantically structured, results.
By providing a way to codify and organize the common “class” and “id” names, element/class/id pairings, and fragments of content that you repeatedly use in producing a body of work, snippet sets make it easy to develop and stick to your chosen conventions. The snippets you define become first-class extensions to HTML, that appear alongside the standard HTML element set in TypeMetal’s completion UI. You aren’t required to declare your common HTML building blocks in a TypeMetal snippet set, but doing so puts them at your fingertips at writing and editing time, and makes your chosen markup conventions much easier to remember and apply consistently.
What They Are
A TypeMetal “snippet”, in its most general form, can be any arbitrary fragment or “clipping” of HTML. Often, however, you’ll deal with “simple” snippets, that consist of a single HTML element with optional “class” and/or “id” attributes. TypeMetal makes both simple and general snippets easy to create, edit, and use.
A “snippet set” is a collection of snippets that’s given a title and saved in a single file. Taken together, the snippets describe the set of HTML elements, “class” and “id” attributes, and common HTML constructs that you use to mark up content for a particular publishing destination (or for a local collection of HTML content, such as your own notes). In this way, the snippet set establishes conventions that content written for the site should follow. Content that conforms to a site’s conventions will be displayed with the styling the designer intended, while remaining maximally flexible to future styling changes. Adherence to common conventions lends a site both stylistic malleability and the necessary foundation for a cohesive, polished, professional look and feel.
Snippet Set Files
TypeMetal stores each snippet set you create in a snippet set file. A snippet set file is represented by the following icon:
You can share your snippet set files with others, and use snippet sets provided by others to tailor your writing to the requirements and styling conventions of a particular website, content management system, or other publishing destination.
When you edit an HTML file in TypeMetal, you can specify a snippet set to use. Any creation of new elements you perform in that document will be informed and guided by the snippet set, in addition to the applicable HTML spec. TypeMetal associates the snippet set file with the HTML file, in much the same way a stylesheet can be associated with an HTML file, so that the snippet set will be remembered for future editing sessions.
A snippet set can also be associated with a TypeMetal WordPress project, for use when writing post and page content in “Classic Mode” (arbitrary general HTML). Snippet sets are not currently applicable to WordPress “Block Mode” content.