Extension:BacktickCode

The BacktickCode extension wraps &lt;code> tags around wikitext which is placed `between backtick characters`.

This provides a handy wiki-editing shortcut for wikis that expect a lot of inlined &lt;code> snippets in its pages, and functions similarly to the standard MediaWiki ''' -> &lt;b> bold formatting shortcut.

Backtick characters within &lt;pre> blocks will not be altered by this extension. Backticks outside of &lt;pre> blocks can also be output to the page by escaping them as \</tt>`</tt>.

Code
' and '\`' by '`'. // Text between tags is not modified. $text = preg_replace_callback('/ (.*?)<\/pre>/s', function ($match) {           return ' ' . preg_replace('/`/', '\`', $match[1]) . ' ';        }, $text); $text = preg_replace('/([^\\\\]|^)`([^`]*)`/', '$1 ', $text); $text = preg_replace('/\\\\\`/', '`', $text);
 * BacktickCode.php (PHP 5.3+)

return true; }

' and '\`' by '`'. // Text between tags is not modified. $text = preg_replace_callback('/ (.*?)<\/pre>/s', replaceBacktickCode, $text); $text = preg_replace('/([^\\\\]|^)`([^`]*)`/', '$1 ', $text); $text = preg_replace('/\\\\\`/', '`', $text);
 * BacktickCode.php (PHP 5.2+)

return true; }

Credits
This extension is derived from Extension:DollarSign.