<-    -c-    ->    

chapter 3

chunks come in two flavors

now we get to the actual markup instructions.

you know that "chunks" are the basic unit of the file, any contiguous non-blank line(s) that are separated by blank lines above and below.

so a "plain old paragraph" -- like this one -- is a chunk, and a chunk is easy to recognize.

the trick is for z.m.l. to know what kind of "structural element" each chunk represents; i.e., what the chunk "is", in terms of the book.

sometimes, z.m.l. can ascertain it fairly easily.

for instance, this paragraph right here is just another "plain old paragraph", and z.m.l. can determine that without breaking any sweat.

if the text of a chunk starts at the left margin, with a letter, z.m.l. says "that is a paragraph."

simple enough.

***

and if the text of a chunk starts with a number, z.m.l. considers it as a "numbered paragraph". which means it will be formatted specially, with its body indented from the left, while its number remains at the margin isolated as an "outdent".

so if that's the look you want, you know that you must start your paragraph with a number.

(of course, that's what you were going to do anyway, because that's the normal thing to do, which is why light-markup is so simple, since you just do what you were going to do anyway.)

***

if the text of a chunk starts with a left-bracket z.m.l. determines that signal to be a footnote -- or end-note, but let's not split hairs yet -- which means it too will get special formatting, when the time comes to create output formats, in a manner that you're familiar with, if you've ever looked at the end-note section of a book. (it's similar to the numbered paragraph, actually, with the number of the end-note as an outdent.)

however, there's more to it than that, because in addition to special formatting at output time, z.m.l. also knows that a footnote/endnote is a special type of element referring to some other place in the document, a place with a matching number (or name), likewise enclosed in brackets.

so z.m.l. sets out to find that matching location, and when it does, automatically creates mutual cross-links that join the two love-birds together.

you have to make sure, of course, that there are matching numbers/names, but that's easy to do, and once you've done your simple part correctly, z.m.l. goes out and re-does all the grunge work every time you ask it to generate output for you.

***

there are other types of paragraphs, as well, but the point is that the first major flavor of chunk is the "paragraph", usually the "plain old paragraph". it's the meat-and-potatoes of structural elements.

the other major chunk flavor -- the spicy one -- we will call the "block". it's probably not the best name, especially as it's already quite overloaded, but it should work well enough for our purposes.

paragraphs are boring, but blocks are exciting.

if you know .html, most of the "tags" you know (and love so much, i'm sure) are "blocks" in z.m.l.

they include block-quotes (of course), tables, lists (both unordered and ordered) and so on.

***

z.m.l. has one simple way it recognizes a block:

whenever a chunk starts with a space, it's a block.

that is, to put it from the opposite perspective, every time you want to signal a block to z.m.l., you will start the text of the chunk with a space.

there are a variety of different "tags" you will use, to signal lists and blockquotes and tables and such, but every one starts with a space in column one.

further, most of them take a specific extended form, where the second column in the chunk is the "tag", and the third column is then again another space.

so most block indicators are: space-tag-space.

here's a bunch of them, quickly, to get your feet wet.

space-asterisk-space == tag for an unordered list == " * "

space->-space == tag for a block-quote == " > "

space-|-space == tag for a table == " | "

space-#-space == tag for an ordered list == " # "

space-o-space == unordered list, different bullet == " o "

space-+-space == unordered list, different indent == " + "

space-=-space == unordered list, different bullet == " = "

space-x-space == unordered list, no bullet == " x "

all of those lines above are chunks which are in turn "plain old paragraphs", since they start with a letter as their initial character, so that gives a certain look.

but now let's see that same list of tags, as a list:

once you've learned the tag for a structural element, it's tremendously easy to use it in your writing, and it's fast, plus it doesn't gunk up your text, which is another reason light-markup is so good for writers.

***

as i said, most tags use this space-tag-space form. but there are some exceptions. one of my favorite is the shortcut that means "please center this line".

it's very simple. you just put a space in column one, and then start in with your line. works like a charm.

indeed, it's the secret behind those lines you've seen used right here in this text, consisting of 3 asterisks, the kind that often serve as "scene-breaks" in novels. if you look at the input-file, you'll see they have a space in column one, followed by those 3 asterisks, and they are automatically centered in rendered output.

so let's look at that list again, this time centered:

space-asterisk-space == tag for an unordered list
space->-space == tag for a block-quote
space-|-space == tag for a table
space-#-space == tag for an ordered list
space-o-space == unordered list, different bullet
space-+-space == unordered list, different indent
space-=-space == unordered list, different bullet
space-x-space == unordered list, no bullet

well, it ain't gonna win any beauty contents, for sure, but as far as doing the job, quickly and easily, it works.