|P is for Practical|
Markup in the Monasteryby SiteDocClan
|on Mar 17, 2008 at 22:39 UTC||Need Help??|
Markup in the Monastery
There are just two basic markup elements you MUST use when posting a comment or question:
<p>...</p> Paragraph tags, so the narrative part of your node won't be an unreadable mismash.
<c>...</c> Code tags around code and data (which can be cut and pasted direct from your editor).
And now you know those, you can go back to creating your node unless you'd like to learn more.
Here's a synopsis of important tags and their actions:
PM markup code is NOT entirely w3c html 4.01 standard nor is it XHTML, so even if you're expert please scan these notes.
Ordinary paragraphing is accomplished with <p>...</p> tags, which (imprecisely) allow you to have your text appear in what may be called "conventional" paragraphs; that is with blank lines between paragraphs. That's highly recommended, as it makes your node easier to read.
Links: Please, do NOT use <a href="http://example.com">something</a>. Instead, create links (especially those to nodes at PM) using [...] The ... inside the square brackets may be a node's title or its id://(number). Optionally, you can override the target's title with your chosen alternate by adding |(some word or phrase) after the id or title before closing the square brackets.
For example, [Super Search|Did you try to find that here?] will render as Did you try to find that here?. More extensive and sophisticated information can be found in What shortcuts can I use for linking to other information?.
Lists: lists can be either ordered (decimal numbered - using Roman numerals or letters is beyond the scope of this note) or unordered (bulleted). One of each follows; first the ordered list, created with this:
<ol><li>line 1 of list</li><li>line 2 of list</li><li>and so on</li><ol>
The unordered list uses <ul>...</ul> around the list item <li>...</li> tags:
<b>...</b> can be used to enclose words, phrases or sentences you want to have appear in boldface. As a courtesy, do NOT abuse this... and use the preview function to check. Similarly, <i>...</i> can be used to italicize content.
<tt>...</tt> tags surrounding a word or phrase (commonly, a single key word or symbol) cause that word or phrase to be rendered in something akin to a system font; eg: key words within the surrounding text.
Heading tags, <h3>...</h3>, and smaller (through <h6>) may be used. Head tags, unsurprisingly, cause their content to render as headlines. For example
<h6>A smaller headline</h6>
Any <hn> ... </hn> tag pair can be thought of as implying line breaks above and below (absent manipulation with css or other techniques far beyond the scope of this node). Please note that <h1> and <h2>are discouraged here.
<blockquote>...<blockquote> is used to indent a (brief, please) segment of your text and works like this (the fixed width pseudo-tags, below, illustrate the actual useage):
<blockquote>This is a blockquote. Note that it is indented both left and right and offset top and bottom by a blank line. This blockquote rambles on to ensure that regardless of the width of the viewer's browser window, there are multiple lines inside the blockquote. Note that there are no paragraph tags around this paragraph although using them would be allowed...and that it is permissable to include, for example, <b>textual</b> <i>markupWhat's more a blockquote can include multiple paragraphs. Again, this is padded with enough non-substantive verbiage to make it wrap in most user's browser windows.</p></blockquote>
If you find it necessary (and you should make every effort to ensure it is NOT) to create a very long post, please use <readmore> ... </readmore tags. Should your post make it to the front page, the readmore segment collapses to a link by which the interested reader can see the entire post.
Puzzle answers aka spoilersIf you post a puzzle, enclose the answer in <spoiler></spoiler> tags, so you don't spoil the puzzle fun for others.
Detail: <spoiler>...</spoiler> tags are intended to (temporarily) redact (in the intel world's sense; "black out") some brief piece of text or code whose visibility would spoil a thread for some future reader. Example:
This sentence is inside spoiler tags.In a simple case, the material inside the spoiler tags will become visible when highlighted; the general idea being that a little more work is required to see the content than simply viewing a node.
The reader's preference settings may cause <spoiler> tags to be rendered in unexpected ways. Note that when wrapped in <c><code> tags the </c>
Nesting: Check for proper nesting. For example, if you open a paragraph tag, close it before beginning a blockquote or code segment. And that leads us directly to the next important pair of tags.
Use code tags, <c>..</c> (or <code>...</code>), to post code and data. Doing so preserves your indentation, blank lines and those symbols for which use of character-entities is conventional elsewhere. Char-entities are discussed further, below
A typical use would be to cut'n'paste your code into a PM node Code tags cause the code (or data) they enclose to appear in a distinguishable font. If you have turned on line-numbering in the section on "Code Listing Setings" in Display Settings the code lines will be numbered. The following is inside <c>...</c> tags.
Note the download link, above. It appears after each stand-alone code block and allows readers to retrieve the code or data, without the line numbers.
Note that in line 11 the "&" did NOT have to be written as a character entity (&). If you're not seeing line numbering, see that setting in Display Settings.
Tags You Should NOT Use
At first blush, the <pre> ...</pre> pair may look like an alternative to code tags... BUT DON'T USE IT HERE chiefly because <pre>...</pre> tags will not persuade the Monastery to provide a download link for the contents of the <pre>... and while it is now supposed to wrap lines that are too long for the viewer's browser window, there are ways Monks could use CSS that would defeat that. So, please. don't use <pre>...</pre>.
Inserting a <br> tag forces a newline at the point at which it's inserted. Monastery documents differ on its acceptability. Using <div>...</div> tags is NOT deprecated, but unless you're expert in .html, you probably shouldn't use them here.
<font (something="something")>... </font> tags are frowned upon. Don't use them except in extraordinary circumstances.
Please read carefully the hints which appear below the text entry box when you're creating a node. Outside code tags
If you are a logged-in user, you have Display Settings which you can check or change. See particularly the section HTML Related Options. It is highly recommended that you check the checkbox and set the two other options to their maximum values (3 and 4, respectively). These will tell you quite clearly when you omit a required tag, and will help when you bork tag nesting rules.
Most of the tags discussed above should be used in pairs (that is, <tag>... </tag>. While some of the other tags addressed in this node will DWIM even if you fail to close them, the <b>, <i>, and <tt> tags will not, nor will some "block level" tags like <ol>.
A table listing all PM-approved html and arguments is available for those who wish to delve deeper.
Beware of using your browser's "view page source" feature to see how a writeup has been formatted. Not only are you viewing a node after it has been processed by PerlMonks (turning What shortcuts can I use for linking to other information? into actual links, for example), but many browsers do additional processing on received pages, such as inserting missing closing tags.
In the interest of brevity and simplicity, some statements above are oversimplified... and some do NOT apply to the CB, for which see PerlMonks Approved Chatter HTML Tags.
None of this will be much help if your content is unclear. Use an explanatory title, standard spelling, grammar, and punctuation. If posting a question, explain exactly what your problem is (and include warnings and error messages, verbatim, if received). Tell us what your input is in a separate code block or as a <DATA> section at the end of your code. Be explicit about the expected output, unless that's utterly unambiguous, and tell us how what you're getting, if anything, deviates from your expectations or desires.
How do I post a question effectively?, Before You Post ... and On asking for help address many valuable points. If you're new to the Monastery, you'll profit greatly — EVEN IF YOU'RE IN A RUSH TO GET AN ANSWER — by reading these. And, oh yes, remember, "Your 'urgent need' is not our emergency."
Back to the PerlMonks FAQ.