log in

tsunami syntax

Luke Breuer
2015-12-07 08:48 UTC

This lightweight syntax is subject to change, perhaps to more fully align it with Markdown. (Also see Is HTML a Humane Markup Language?.) Also see a few webmark links on lightweight-syntax-markup.
- bulleted
1. numbered
a. lettered

Nest lists by indenting two spaces at a time; different types of lists can be nested inside of each other.
Hyperlinks matching the regular expression below get auto-linked.

Hyperlinks may be included as footnotes:
  • "reference them like this"[1]
  • [1] http://example.com?q=declare_them_like_this
    • zero or more whitespace chars between the ] and the start of the protocol
    • footnotes declarations must follow the reference(s)
    • the earliest matching declaration found below the reference is used

To link from item to item, do [[whatever]], [[12|test]], or [[whatever/12|ooh]]. The |foo portion is optional, and will display as the anchor text if specified. (Maybe the number-only version gets auto-converted to name/number when the item is saved.) No existence check is made.
Bold, italics, strikethrough
--strikethrough-- -> strikethrough
*bold* -> bold
_italics_ -> italics
1-6 = can be used at the beginning of a line to wrap it in <h6>-<h1>, respectively.
Line break magic
If there are 2+ blank lines before/after a bullet or {{}}, one of them is removed (so the plaintext can be separated but the rendered text doesn't look all spaced out).
Monospacing (for code)
{{code}} renders <pre>; The text within has tabs intelligently turned into <= 4 spaces upon rendering. If any line is longer than 80 characters, the width of the <pre> is explicitly set.

Preceding a line inside {{}} with ! will cause that line to be highlit, excluding leading and trailing whitespace.

`code` renders as <code> unless the first ` is written as \` (single line only)
Preceding [[, {{, and any other special characters with \ prevents them from being parsed.
This is quoted text.
This is quoted text starting with !.
^[ ]*".+?"[ ]*$ -> <blockquote>

"! gets rendered with a red bar instead of a gray one — this is good for documenting error messages, like these three
" -- " -> &mdash; ( — ) if outside of {{}} (note the surrounding spaces)
Hyperlink regex:
[a-zA-Z]+://               # protocol
  (?<p>\()                 # [track] open parentheses
  [\w#~@#$%&\-+=/?.,:;!'*] # valid URL characters (excluding parens)
  (?(p)                    # allow one close paren for each open
    (?<-p>\))              # see balanced constructs with .NET Regex
(?<![.,:;!])               # last character cannot be punctuation