DESCRIPTION

Auto-codes is an extension.

An auto-code is a word that is rendered as code even though it isn't surrounded by grave accents. The word does not include white space, and starts and ends on a word boundary, that is, a printable character that is not a space or a letter or a digit.

SUPPORTED AUTO-CODES

absolute path β€” any word that starts with / and is at least four-bytes long.

  • 1 byte = 1 character for the ASCII and 8-bit character sets
  • 2 to 4 bytes = 1 character for other unicode characters
  • Thus:

  • /123 /naΓ―ve /πŸ˜ƒ
  • β€œ/dir/file” β€˜/dir/file’ /file.. β€œ/file,” β€˜/file:’ /file; /file! /file?
  • /dir/ β€œ/dir/” (a terminating slash is included)
  • not /12 /1 / /Β§ (too short: 3, 2, 1 and 2 bytes respectively)
  • not /12/ β€œ/12/” (a terminating slash is not counted in the byte count)
  • not β€œ/file name” (two words: Β«"/fileΒ» and Β«nameΒ»)
  • not ../filepath filename (neither word starts with β€œ/”)
  • special file names

    file names ending with extensions β€œ.patch” or β€œ.diff”:

  • file.patch f.diff β€œf.diff”
  • f.diff, f.diff.
  • not .patch .diff β€œ.diff” (need a file name, just the extension is not enough)
  • not f.diff.old (does not end with the right extension)
  • Caveat: β€œf.diff.”
  • URI

  • http:// https:// ftp://
  • http://www https://www.example ftp://www.example.com
  • <https://www.example.com>, β€œhttp://example.com”, (https://www.example.com),
  • http://a.com/ http://a.com? http://a.com?v= http://a.com?v=.
  • issue id (bugzilla, gh) β€” ASCII word preceded by β€œ#”

  • #123 #abc
  • not #123 #abc (backslash escapes)
  • function name β€” ASCII identifier that ends with β€œ()”

  • foo() foo(); foo_bar() f9()
  • escaping and not escaping leading underscore: _foo() _foo()
  • not () β€œ()” (no identifier)
  • not 32() (32 not an identifier)
  • uppercase identifier β€” uppercase ASCII identifier that includes at least one underscore

  • XDG_CONFIG_HOME and _Z_DATA
  • $XDG_CONFIG_HOME also if it starts with β€œ$”
  • with all underscores escaped: _ _A _B_
  • with the first but not the last underscore escaped: _C_
  • not DISPLAY (no underscore), $HOME (no underscore)
  • not HOME (italics)
  • email address β€” ASCII word, must not start with β€œ@” or β€œ.”, must include one β€œ@” and at least one interior β€œ.”

  • a@b.com
  • not @ @ID macro@ @@@@@@@@@
  • FORMATTING

    Exterior formatting - italics, bold, strike-through - is applied to auto-codes.

  • /root
  • /italics /bold /strikethrough
  • /3/star/bold-italics / / / / /3/under/bold-italics
  • bold italics strike through
  • #123 #abc #123 #abc
  • http:// https:// ftp:// http:// https:// ftp://
  • file.patch file.diff file.patch file.diff
  • foo() foo()
  • XDG_CONFIG_HOME _Z_DATA $XDG_CONFIG_HOME XDG_CONFIG_HOME _Z_DATA $XDG_CONFIG_HOME
  • XDG_CONFIG_HOME _Z_DATA $XDG_CONFIG_HOME XDG_CONFIG_HOME _Z_DATA $XDG_CONFIG_HOME
  • a@b.com a@b.com
  • BACKTICK TESTS

    The text below includes backticks to explicitly format code chunks. Therefore no auto-code should be applied.

  • three words: cp /tmp/a /tmp/b
  • three words: #1 and #2
  • three words: _A_ and *_Z*
  • Exterior formatting is applied to explicit code chunks:

  • two italics words and a bold URI: foo() user@email.com https://mdview.com
  • Mixing code chunks, auto-codes and formatting works:

  • cp /code /auto-code
  • ln -s /auto-code
  • MISCELLANEOUS TESTS

  • two isolated quotes: " '
  • this line ends with a single backslash
  • this line ends with two backslashes \
  • a β€” z (em-dash " -- ")