mattermost/server/tests/test-syntax-highlighting.md

2.4 KiB

Code Syntax Highlighting

Verify the following code blocks render as code blocks and highlight properly.

Diff

*** /path/to/original	''timestamp''
--- /path/to/new	''timestamp''
***************
*** 1 ****
! This is a line.
--- 1 ---
! This is a replacement line.
It is important to spell
-removed line
+new line

Makefile

CC=gcc
CFLAGS=-I.

hellomake: hellomake.o hellofunc.o
     $(CC) -o hellomake hellomake.o hellofunc.o -I.

JSON

{"employees":[
    {"firstName":"John", "lastName":"Doe"},
]}

Markdown

**bold** 
*italics* 
[link](www.example.com)

JavaScript

document.write('Hello, world!');

CSS

body {
    background-color: red;
}

Objective C

#import <stdio.h>

int main (void)
{
	printf ("Hello world!\n");
}

Python

print "Hello, world!"

XML

<employees>
    <employee>
        <firstName>John</firstName> <lastName>Doe</lastName>
    </employee>
</employees>

Perl

print "Hello, World!\n";

Bash

echo "Hello World"

PHP

 <?php echo '<p>Hello World</p>'; ?> 

CoffeeScript

console.log(Hello world!);

C#

using System;
class Program
{
    public static void Main(string[] args)
    {
        Console.WriteLine("Hello, world!");
    }
}

C++

#include <iostream.h>

main()
{
    cout << "Hello World!";
    return 0;
}

SQL

SELECT column_name,column_name
FROM table_name;

Go

package main
import "fmt"
func main() {
    fmt.Println("Hello, 世界")
}

Ruby

puts "Hello, world!"

Java

import javax.swing.JFrame;  //Importing class JFrame
import javax.swing.JLabel;  //Importing class JLabel
public class HelloWorld {
    public static void main(String[] args) {
        JFrame frame = new JFrame();           //Creating frame
        frame.setTitle("Hi!");                 //Setting title frame
        frame.add(new JLabel("Hello, world!"));//Adding text to frame
        frame.pack();                          //Setting size to smallest
        frame.setLocationRelativeTo(null);     //Centering frame
        frame.setVisible(true);                //Showing frame
    }
}

Latex Equation

\frac{d}{dx}\left( \int_{0}^{x} f(u)\,du\right)=f(x).