xaizek / rocketgit (License: AGPLv3+) (since 2018-12-09)
Light and fast Git hosting solution suitable to serve both as a hub or as a personal code storage with its tickets, pull requests, API and much more.
<root> / tests / format.php (2356f2185836a563492694759ba2152105bf5855) (2,400B) (mode 100644) [raw]
<?php
error_reporting(E_ALL | E_STRICT);

$INC = dirname(__FILE__) . '/../inc';
require_once($INC . '/init.inc.php');
require_once($INC . '/log.inc.php');
require_once($INC . '/format.inc.php');

rg_log_set_file('format.log');

$a = '';
$e = '';

$a .= 'Title h1' . "\n";
$a .= '========' . "\n";
$e .= '<h1>Title h1</h1>' . "\n";

$a .= 'Title h2' . "\n";
$a .= '--------' . "\n";
$e .= '<h2>Title h2</h2>' . "\n";

// force a paragraph as well
$a .= "\n" . 'This should be **bold** and this *italic*.' . "\n\n";
$e .= "\n" . '<p>' . "\n" . 'This should be <strong>bold</strong> and this <em>italic</em>.' . "\n" . '</p>' . "\n\n";

// paragraph should end at the end of the text
$a .= 'This should be __bold__ and this _italic_' . "\n";
$e .= '<p>' . "\n" . 'This should be <strong>bold</strong> and this <em>italic</em>' . "\n";

// Verify that we are not greedy
$a .= "\n" . '**Greedy** - **test**.' . "\n";
$e .= "\n" . '<strong>Greedy</strong> - <strong>test</strong>.' . "\n";

$a .= '###### This should be a H6' . "\n";
$e .= '<h6>This should be a H6</h6>' . "\n";

$a .= '# This should be a H1' . "\n";
$e .= '<h1>This should be a H1</h1>' . "\n";

$a .= '###### This should be a H6' . "\n";
$e .= '<h6>This should be a H6</h6>' . "\n";

$a .= '---' . "\n";
$e .= '<hr />' . "\n";

$a .= '> blockquote' . "\n";
$e .= '<blockquote><p>blockquote</p></blockquote>' . "\n";

$a .= '~~strike~~' . "\n";
$e .= '<strike>strike</strike>' . "\n";

$a .= '`some code`' . "\n";
$e .= '<code>some code</code>' . "\n";

$a .= 'This should be a [link](http://rocketgit.com)' . "\n";
$e .= 'This should be a <a href="http://rocketgit.com" target="_blank">link</a>' . "\n";

$a .= 'aaa | bbb | ccc' . "\n";
$a .= '--- | --- | ---' . "\n";
$a .= 'xxx | yyy | zzz' . "\n";
$e .= '';
$e .= '<table>' . "\n";
$e .= '<tr><th>aaa</th><th>bbb</th><th>ccc</th></tr>' . "\n";
$e .= '<tr><td>xxx</td><td>yyy</td><td>zzz</td></tr>' . "\n";
$e .= '</table>' . "\n";

$a .= '![Image](Icon-pictures.png "icon")' . "\n";
$e .= '<img alt="Image" title="icon" src="Icon-pictures.png" />' . "\n";

$a .= '2 spaces in the end  ' . "\n";
$e .= '2 spaces in the end<br />' . "\n";

$e .= '</p>';

$r = rg_format_markdown($a);
if (strcmp($r, $e) != 0) {
	rg_log('Markdown error! Check format.md.r and format.md.e file!');
	file_put_contents('format.md.r', $r);
	file_put_contents('format.md.e', $e);
	exit(1);
}


rg_log('OK');

Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/rocketgit

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/rocketgit

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master