Files
RedBear-OS/local/recipes/kde/kf6-syntaxhighlighting/source/autotests/input/test.markdown
T

9.3 KiB

Title, Author, Date, Comment
Title Author Date Comment
A Sample Markdown Document Fletcher T. Penney February 9, 2011 This is a comment intended to demonstrate metadata that spans multiple lines.

H1

H2

H3

Multi-line paragraph bla bla bla bla bla bla.

Intentional line break
via two spaces at line.

Formats: italic, bold, monospace, strikeout, ==highlight==

Emoji: 😂 👍

Table:

Syntax Description Test Text Note
Header Title | this

Bullet list:

  • item1
  • item2

Numbered list:

  1. item 1
  2. item 2

Task list:

  • Finish my changes
  • Push my commits
  • Open a pull request

A link as normal text: http://example.com

link

Auto-link: http://kate-editor.org Mail: mailto:mark@kde.org

This is an example inline link.

See my About page for details.

This is [an example] id reference-style link.

Alt text

Alt text

Alt text

code 1
code 2

normal text

block quote italic more block quote

normal text

Title: some text

normal text

Lists

  1. item
    • This is a list item with multiple lines.

      code
      

      This is a blockquote

      This is a new paragraph, which is part of the item in the previous list.

      indented code block
      

      Other paragraph.

      • subitem
        • subitem with multiple lines.

          New paragraph of the previous subitem.

          code block
          

          Other paragraph of the subitem.

          1. numlist item

          2. numlist item

            New paragraph of the previous item.

            Blockquote

            code block
            

            Other paragraph.

Inline HTML

© bold code

a b
  • c
  • d
e

normal text italic

Code

simple code

simple ` code

simple `` ` code

simple`code

normal text normal text normal text normal text

code blocks are only allowed
after an empty line.
  • list list

    normal text

  1. num-list num-list

    normal text

quote quote

code block

normal

<!-- code, not comment -->
code

normal

code

Fenced code blocks (bug 356974)

Bash

#!/usr/bin/env bash

for f in *; do
    echo "$f"
done

C++

#include <QtCore/QObject>

class Q : public QObject {
Q_OBJECT
public:
    Q();
}

Q::Q() :QObject(NULL) {
}

C

#include <stdio.h>
#include "stdint.h"
#define SOME_VAR 1

static uint64_t intWithSuffix = 42ull + ~1233L;
static int octNum = 07232;

C#

var arr = new[] { 0, 1, 2, 3, 4 };
var anon = new { Country = "Germany", Inhabitants = 80000000 };

CMake

cmake_minimum_required(VERSION 3.10 FATAL_ERROR)

project (hello_world)

set(QT_MIN_VERSION "5.6.0")

CSS

h1.main::hover {
    font-size: 100;
    color: green;
}

Email

From: Konqi Dragon <konqi@kde.org>
To: All <all@kde.og>
Subject: highlights

Go

package main

import "fmt"

func main() {
  fmt.Println("Hola, mundo.")
}

Haskell

module Main (main) where

main :: IO ()
main = putStrLn "Hello, World!"

HTML

<html>
  <body>
    <p class="main">Hello world!</p>
  </body>
</html>

Java

package fibsandlies;
import java.util.HashMap;

/**
 * This is an example of a Javadoc comment; Javadoc can compile documentation
 * from this text. Javadoc comments must immediately precede the class, method, or field being documented.
 */
public class FibCalculator extends Fibonacci implements Calculator {

    private static Map<Integer, Integer> memoized = new HashMap<Integer, Integer>();
    public static void main(String[] args) {
        memoized.put(1, 1);
        memoized.put(2, 1);
        System.out.println(fibonacci(12));
    }
}

JavaScript

function factorial(n) {
    if (n === 0) {
        return 1;  // 0! = 1
    }
    return n * factorial(n - 1);
}

JavaScript React (JSX)

<hello />
function Story(props) {
  const SpecificStory = components[props.storyType];
  return <SpecificStory story={ props.story } attr2="&ref;" attr3="Hello\n" />;
}

JSON

[{
    "hello": "world",
    "count": 1,
    "bool": true
}]

Matlab

% Numbers _____________________________________________
5, 5.5, .1, 0.1, 0.4e5, 1.2e-5, 5i, 5.3i, 6j, .345+3i
5', 5.5', .1', 0.1', 0.4e5', 1.2e-5', 5i', 5.3i', 6j', .345+3i'

Markdown

**bold** `code`
> quote

Mustache/Handlebars

{{#movie}}
    <div>
        <h1>{{title}}</h1>
        <img src="{{poster}}" alt="{{title}}"/>
    </div>
    <div>
        Rating - {{ratings.critics_rating}}
    </div>
{{/movie}}

Perl

my $var = shift;

$var =~ s/bla/foo/igs;
$var =~ s!bla!foo!igs;
$var =~ s#bla#foo#igs;

PHP

namespace Application\Controller;

use Zend\Mvc\Controller\AbstractActionController;

class IndexController extends AbstractActionController
{
}

Python

def addXToY(x, y):
    total = x + y
    print total

QML

Text {
    id: hello
    width: 100
    text: "Hello world!"
}

R

# Declare function “f” with parameters “x”, “y“
# that returns a linear combination of x and y.
f <- function(x, y) {
  z <- 3 * x + 4 * y
  return(z)
}

Raku

grammar Parser {
    rule  TOP  { I <love> <lang> }
    token love { '' | love }
    token lang { < Raku Perl Rust Go Python Ruby > }
}

say Parser.parse: 'I ♥ Raku';

say 1 #`««« blah TODO blah
here? »»» 2 ;
say 1 #` ( blah TODO blah
2 ;
rx- regex -

Ruby

require 'Config'
  def CGI::escape(string)
    string.gsub(/([^ a-zA-Z0-9_.-]+)/n) do
      '%' + $1.unpack('H2' * $1.size).join('%').upcase
    end.tr(' ', '+')
  end

Rust

fn main() {
    println!("Hello world!");
}

MySQL

-- comment
CREATE TABLE stuff COLUMNS(col1 INT, col2 Varchar);
SELECT * FROM stuff WHERE id = 'string';
select * from stuff where id < 0.42;
Select col1, col2 From stuff Where stuff.col1 IS NOT NuLL;

Nim

proc main() =
    echo "Hello world!"

TypeScript

class Student {
    fullName: string;
    constructor(public firstName: string, public middleInitial: string, public lastName: string) {
        this.fullName = firstName + " " + middleInitial + " " + lastName;
    }
}

XML

<tag attribute="3">
  <nested/>
</tag>

reStructuredText

Section Header
==============

.. image:: /path/to/image.jpg

- A bullet list item

Doxygen

a normal member taking two arguments and returning an integer value.
@param a an integer argument.
@param s a constant character pointer.
@see Javadoc_Test()
@see publicVar()
@return The test results

No language specified

No language is specified, but it should be still rendered as code block.

Fenced code blocks with more than 3 backticks or tildes

Fenced code block with 3 tildes.
Some implementations of Markdown/MultiMarkdown support more than 3 backticks or tildes.
```
The block ends with the same amount of backticks.
Fenced code block with more tildes.

With languages

<html>
  <body>
    <p class="main">Hello world!</p>
  </body>
</html>
``` <!-- <= doesn't end here -->
for f in *; do
    echo "$f"
done
def addXToY(x, y):
    total = x + y
    print total
~~~ # <= doesn't end here

Italic and bold text

b i b i ib ib ib ib

  • italic bold ib strikeout

italic bold ib strikeout

Bold

bold___text* normal bold***text_ normal

Italic

italic _ text normal italic * text normal

Italic-Bold

italic-bold ** italic-bold normal *bold-italic text bold-italic text normal bolditalic normal bold-italic text normal

_ normal text_ * normal text * italic textnormal text* italic text italic text bold textnormal text* **bold text bold text

aaabold textaaaaa aaa__normal text__aaaaa пристаням_стремятся_

*normal text* _normal text_ *italic text* only bold* bold* bold

Highlight

==very important words== normal ==very=important=words== normal

1

2

3

4

5
6

11; 1-6 should close here

22

33

222; 22 and 33 should close here