Syntax highlighting

from Wikipedia, the free encyclopedia
Syntax highlighting in an HTML document

Syntax highlighting or syntax highlighting is the ability of a computer program to display certain words and character combinations in a text in different colors, fonts and styles depending on their meaning. Syntax highlighting is mainly used in text editors for editing excellent documents , program source texts and configuration files . Keywords and other language elements are highlighted .

Syntax highlighting improves the readability of texts: Structures in the text are easier to recognize, "skewed reading" is simplified, comments appear separate from the actual code and typing errors are noticed more quickly, as in many cases a typing error leads to a changed display.

Syntax highlighting is now part of the standard functionality of many integrated development environments and text editors. The MediaWiki engine, which is used by Wikipedia , for example , supports an extension for syntax highlighting in many languages with Pygments .

Example of syntax highlighting

The following example, which is written in the C programming language , demonstrates the syntax highlighting. The highlighting marks functions and other language elements.

#include <stdio.h>

int main(void) {
        printf("Hello World\n");
        return 0;
}

Web links