# 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 " \-\- ")
