'MediaWiki breaks when I put C++ code in preformatted text
I want to use MediaWiki to document a C++ coding project. I am dropping code snippets into a preformatted text block. The problem is, when I include a line of code like:
if(x == y)
it breaks the page. I'm assuming the parser thinks is markup opening heading with no matching close.
Is there a way to mark the == so that it isn't taken as markup. Haven't been able to find a reference.
Solution 1:[1]
Activate SyntaxHighlight in your LocalSettings.php with wfLoadExtension( 'SyntaxHighlight_GeSHi' );. make sure /path/to/extensions/SyntaxHighlight_GeSHi/pygments/pygmentize has execution permissions and wrap your code snippets with <syntaxhighlight lang="C++">...</syntaxhighlight>,
OR
wrap your snippets with <pre>...</pre>,
OR
indent every line of your snippets with at least one space.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Alexander Mashin |
