# Markdown Syntax (todo: include class names for enabling these features) ## Block Formats Formats that apply to one or more lines. ### Paragraph Any contiguous set of lines not formatted like one of the other formats below is treated as a paragraph. Paragraphs are separated by double blank lines. ```markdown Lorem ipsum dolor sit amet. New paragraph begins. ``` ### Headers Headers are marked with one or more leading hashes. ```markdown # Header 1 has one hash ## Header 2 has two hashes ###### Up to header 6 ## Optional Matched Hashes At The End ## ``` Alternately, H1 and H2 can be marked with underlines. ```markdown Header 1 underlined with equals =============================== Header 2 with hyphens. Number of underline chars doesn't matter --- ``` ### Lists Unordered lists are bulleted with an asterisk, plus, or hyphen and space. ```markdown * Item + Any of these - Work as bullets ``` Lists can be nested with one or more spaces below an item. ```markdown * Item * Sublist * Sublist * Item ``` Ordered lists start with a number, period, and space. ```markdown 1. Item 2. Item 3. Item ``` Again, they can be nested. ```markdown 1. Item 1. Subitem 2. Subitem 2. Item ``` The first number dictates where the numbering begins. The numbers on the other items are ignored and incremented by one. ```markdown 5. Rendered as a 5 1. Rendered as a 6 1. Rendered as a 7 ``` ### Blockquote Blockquotes enclose lengthy quoted content in an indented block. ```markdown Lorem Ipsum said: > Dolor sit amet > adipiscing. ``` ### Code Blocks Blocks of preformatted code can be enclosed in triple backticks. ```markdown `​`` function foo() { return 'bar'; } `​`` ``` Alternately, lines indented by at least four spaces or a tab character will be interpreted as code blocks. ```markdown function foo() { return 'bar'; } ``` ### Horizontal Rule Horizontal divider lines are written as 3 or more hyphens or asterisks on a line by themselves, with or without interstitial whitespace. ```markdown --- *** - - - - * * * * * * * ``` ### Tables Tables consist of one header row and any number of body rows ```markdown Header | Row | Here ---------|-----|----- Cell | 123 | xyz Next row | 543 | abc ``` The pipe characters do not have to line up. Rows can optionally have leading and/or trailing pipes. This is required for a single column table. ```markdown | One column | | --- | | 123 | | 234 | ``` Columns can be right, center, or left aligned with colons in the divider line. ```markdown | Left | Center | Right | | :--- | :----: | ----: | | 1 | 2 | 3 | ``` Tables can optionally support simple [spreadsheet expressions](spreadsheet.md) by adding the spreadsheet block reader when configuring a parser. ### Definition List Definition lists show terms with definitions below them. Useful for glossaries. ```markdown term : definition of term another : definition of another : alternate definition of another ``` ### Abbreviation Definition Abbreviations can be defined anywhere in the document. Anywhere that abbreviation appears in the document will have a mouseover title showing the expanded definition. The definition is plaintext only (no markdown). ```markdown *[ABC]: Always Be Closing ``` ### CSS Modifiers Many block structures can be modified with CSS classes, IDs, or other simple HTML attributes inside curly braces. ```markdown # Header {.mycssclass} --- {#mydividerid} | Table | {style=color:green;} |---| |123| # Multiple Modifiers {.linkclass #linkid lang=en} ``` ## Inline Formats Formats that apply within a block to style runs of words or inject other content within text. ### Strong Text can be marked as bold by enclosing it in double asterisks. ```markdown Some **bold** text. Can also use __underscores__. ``` ### Emphasis Text can be marked as italic by enclosing it in single underscores or single asterisks. ```markdown Some _italic_ text. Can also use *asterisks*. ``` ### Strikethrough Text can be stricken out using tildes, singly or in pairs. ```markdown Not ~~this text~~. Not ~this text~ either. ``` ### Code Words can be rendered in monospace font using single backticks. ```markdown The name of the function is `foo()`. ``` ### Link Linking to a document is done with marked text and a URL. ```markdown Click [here](page.html). ``` An optional mouseover title can be added to the link after the URL. ```markdown Click [here](page.html "Goes to a neat page"). ``` Repetitive or lengthy URLs can be referenced out and defined elsewhere in the document. ```markdown Click [here][foo] or [here][foo] or [even here][foo] to go to the same place. [foo]: page.html "Optional title" ``` Lastly, to make a link with the URL as the link text, you can use angle brackets. ```markdown Go visit . ``` ### Image An image is similar to link syntax with an exclamation in front. Instead of clickable link text, the text is alt text for the image. ```markdown ![a test image](https://picsum.photos/100/75) ``` Images also support title attributes. ```markdown ![a test image](https://picsum.photos/100/75 "title text") ``` Images also support referenced URLs. ```markdown ![alt text][foo] [foo]: https://picsum.photos/100/75 ``` Images can be made clickable by enclosing them in a link where the link text goes. ```markdown [![alt text](image.jpg)](page.html) ``` ### Footnote Footnotes can be inserted into text. The text of the footnotes is added to the bottom of the document, regardless of where they're defined. ```markdown Lorem ipsum[^1] dolor sit[^2] amet. [^1]: Further information here [^2]: See _Interesting Book_, pg 213 ``` ### HTML Tags Currently all HTML tags and attributes are permitted, when markdown syntax doesn't do what you want.