Compare commits

..

No commits in common. 'master' and 'v1.0.0' have entirely different histories.

  1. 35
      CHANGELOG.md
  2. 18
      LICENSE.md
  3. 56
      README.md
  4. 11
      composer.json
  5. 16
      composer.lock
  6. 13
      index.php
  7. 8
      src/Lexer.php
  8. 85
      src/Parser.php
  9. 2
      src/Token.php
  10. 70
      tests/AnnotationsTest.php
  11. 46
      tests/CodeBlocksTest.php
  12. 63
      tests/GenericBlocksTest.php
  13. 65
      tests/HeadingsTest.php
  14. 84
      tests/InlineElementsTest.php
  15. 59
      tests/ListsTest.php
  16. 38
      tests/ReferencesTest.php
  17. 37
      tests/TablesTest.php
  18. 19
      tests/list.md
  19. 2
      tests/paragraph.md
  20. 39
      tests/test1.md
  21. 12
      tests/util.php

@ -1,35 +0,0 @@
# Changelog
## Version 1.2.0
The *"annotation release"*
### Added
* paragraph annotations *(now can set HTML ids and classes with `{.someClass, #someId}` syntax)*
* unit tests for annotation
* unit for headings *(`h1` to `h5`)*
### Removed
* Testing code in `index.php`
## Version 1.1.2
No major changes introduced, getting ready for release
### Changed
* added compatibility for `prism` code highlighting inside code blocks
## Version 1.1.0
No major changes introduced, getting ready for release
### Added
* unit tests via `PHPUnit`
### Changed
* Parser does not generate unnessecary empty paragraphs anymore
* Fix: parse does not get stuck on blockquotes that are not followed by an empty
line anymore
### Removed
* "Monkey test" `.md` files in `tests` folder
## Version 1.0.0
Basic implementation

@ -1,18 +0,0 @@
Copyright (C) 2022, MikO <miko@massivedynamic.eu>
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

@ -13,8 +13,10 @@ Parkdown currently support the following block types:
* paragraphs
* block quotes
* lists *(like this one)*
* also nested
* also nested
* horizontal rules `---`
* lol
* bar
### Supported inline types
Parkdown currently support the following block types:
@ -33,27 +35,11 @@ Parkdown currently support the following block types:
### Paragraphs
```markdown
A simple paragraph can contain **bold text**, `inline codeblocks` and *italic text*. We can also link [with a direct url][https://google.com] *(i.e. to google)*
or via reference to [a later defined url][massivedynamic], if we so desire.
or via reference to [a later defined url][massivedynamic], i we so desire.
```
A simple paragraph can contain **bold text**, `inline codeblocks` and *italic text*. We can also link [with a direct url](https://google.com) *(i.e. to google)*
or via reference to [a later defined url][massivedynamic], if we so desire.
Paragraphs can be annotated with `id` and `class` attributes:
```markdown
Paragraphs can be annotated with ids and classes {.thisIsAClass, .anotherClass, #thisIsAnID}
```
results in
Paragraphs can be annotated with ids and classes {.thisIsAClass, .anotherClass, #thisIsAnID}
```html
<p class="thisIsAClass anotherClass" id="thisIsAnID">
Paragraphs can be annotated with ids and classes
</p>
```
or via reference to [a later defined url][massivedynamic], i we so desire.
### Images
```markdown
@ -73,14 +59,14 @@ Paragraphs can be annotated with ids and classes {.thisIsAClass, .anotherClass,
> Only two things are infinite,
> the universe and human stupidity,
> i am not totally shure about the universe, though...
> Albert Einstein
> - Albert Einstein
```
> Only two things are infinite,
> the universe and human stupidity,
> i am not totally shure about the universe, though...
> Albert Einstein
> - Albert Einstein
### Code blocks
```markdown
@ -126,30 +112,4 @@ Paragraphs can be annotated with ids and classes {.thisIsAClass, .anotherClass,
[massivedynamic]: https://massivedynamic.eu
```
[massivedynamic]: https://massivedynamic.eu
## Usage
Simply construct an new `parkdown\Parkdown` object and pass the Markdown source code to it's constructor. The parsed `DOMDocument` or it's `HTML` output can then be retrieved through the `::html()` and `::tree()` member functions.
**Example**
```php
use parkdown\Parkdown;
$source = "
This is a **bold** word in a paragraph.
";
$parser = new Parkdown($source);
$tree = $parser->tree();
print_r($tree);
echo $parser->html();
```
## Testing
Unit tests can be run via `composer`:
```
composer test
```
[massivedynamic]: https://massivedynamic.eu

@ -1,7 +1,6 @@
{
"name": "massivedynamic/parkdown",
"type": "library",
"version": "v1.2.0",
"license": "MIT",
"autoload": {
"psr-4": {
@ -14,13 +13,7 @@
"email": "miko@massivedynamic.eu"
}
],
"require": {
"php" : ">=8.1"
},
"require-dev": {
"phpunit/phpunit": "^9"
},
"scripts" : {
"test" : "./vendor/bin/phpunit tests --testdox --bootstrap tests/util.php --color"
}
"phpunit/phpunit": "^9.5"
}
}

16
composer.lock generated

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "279a20d650c6a9ed1a0b5762efc6325a",
"content-hash": "e2289ec2def0b32ef8010e9336707400",
"packages": [],
"packages-dev": [
{
@ -848,16 +848,16 @@
},
{
"name": "phpunit/phpunit",
"version": "9.5.18",
"version": "9.5.16",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "1b5856028273bfd855e60a887278857d872ec67a"
"reference": "5ff8c545a50226c569310a35f4fa89d79f1ddfdc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/1b5856028273bfd855e60a887278857d872ec67a",
"reference": "1b5856028273bfd855e60a887278857d872ec67a",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/5ff8c545a50226c569310a35f4fa89d79f1ddfdc",
"reference": "5ff8c545a50226c569310a35f4fa89d79f1ddfdc",
"shasum": ""
},
"require": {
@ -935,7 +935,7 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.18"
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.16"
},
"funding": [
{
@ -947,7 +947,7 @@
"type": "github"
}
],
"time": "2022-03-08T06:52:28+00:00"
"time": "2022-02-23T17:10:58+00:00"
},
{
"name": "sebastian/cli-parser",
@ -2111,5 +2111,5 @@
"prefer-lowest": false,
"platform": [],
"platform-dev": [],
"plugin-api-version": "2.3.0"
"plugin-api-version": "2.1.0"
}

@ -4,24 +4,15 @@ require __DIR__."/vendor/autoload.php";
$source = file_get_contents(dirname(__FILE__)."/README.md");
//$source = file_get_contents(dirname(__FILE__)."/tests/paragraph.md");
//$source = file_get_contents(dirname(__FILE__)."/tests/list.md");
echo "
<style>
body {
padding: 4rem;
margin: 0;
font-family: sans-serif;
}
img {
max-width: 100%;
}
code {
word-break: break-word;
white-space: break-spaces;
}
table {
width: 100%;
}

@ -104,14 +104,6 @@ class Lexer {
$clearBuffer();
array_push($tokens, new Token(TokenType::COLON, $char));
break;
case '{':
$clearBuffer();
array_push($tokens, new Token(TokenType::LBRACE, $char));
break;
case '}':
$clearBuffer();
array_push($tokens, new Token(TokenType::RBRACE, $char));
break;
default:
$buffer .= $char;
break;

@ -2,7 +2,6 @@
namespace parkdown;
use Attribute;
use DOMDocument;
use DOMElement;
use DOMNode;
@ -12,11 +11,6 @@ enum ListType {
case UNORDERED;
}
class Attributes {
public array $classes = [];
public ?string $id = null;
}
class Parser {
const MAGIC_CHAR = "*";
@ -154,8 +148,8 @@ class Parser {
}
private function parseText($paragraph = false) : array {
$elms = [];
$buffer = "";
$elms = [];
$buffer = "";
$clearBuffer = function() use (&$elms, &$buffer) {
array_push($elms, $this->document->createTextNode($buffer));
@ -170,8 +164,7 @@ class Parser {
TokenType::BACKTICK,
TokenType::ASTERISK,
TokenType::LBRACKET,
TokenType::BANG,
TokenType::LBRACE
TokenType::BANG
])) {
$this->consume()->data; // backslash
$buffer .= $this->consume()->data;
@ -235,41 +228,6 @@ class Parser {
$clearBuffer();
array_push($elms, $elm);
continue;
} elseif ($this->current()->type === TokenType::LBRACE) {
$lbrace = $this->consume();
assert($lbrace->type === TokenType::LBRACE, "expected left brace, got ".$lbrace->type->name);
$content = "";
while ($this->current()->type !== TokenType::EOF &&
$this->current()->type !== TokenType::EOL &&
$this->current()->type !== TokenType::RBRACE) {
$content .= $this->consume()->data;
}
$rbrace = $this->consume();
assert($rbrace->type === TokenType::RBRACE, "expected right brace, got ".$rbrace->type->name);
$attributes = array_map(function($element) {
return trim($element);
}, explode(',', $content));
$obj = new Attributes();
foreach($attributes as $attribute) {
if (!in_array($attribute[0], [".", "#"]))
continue;
switch ($attribute[0]) {
case ".":
array_push($obj->classes, substr($attribute, 1));
break;
case "#":
$obj->id = substr($attribute, 1);
break;
default:
continue 2;
}
}
array_push($elms, $obj);
} else
$buffer .= self::StripBackslashes($this->consume()->data);
}
@ -310,7 +268,6 @@ class Parser {
// then we parse the node content
$elm = $this->document->createElement("li");
foreach ($this->parseText() as $node)
if ($node instanceof DOMNode)
$elm->appendChild($node);
// now we check, if the level of the next line is higher than the current level.
@ -344,26 +301,9 @@ class Parser {
}
private function buildParagraph(array $elms) : void {
if (count($elms) < 1)
return;
$elm = $this->document->createElement("p");
$i = 0;
foreach ($elms as $node) {
if ($node instanceof Attributes) {
if (count($node->classes) > 0)
$elm->setAttribute("class", join(" ", $node->classes));
if ($node->id)
$elm->setAttribute("id", $node->id);
continue;
}
if ($node->nodeName === "#text" && trim($node->textContent) === "")
continue;
foreach ($elms as $node)
$elm->appendChild($node);
$i++;
}
if ($i < 1)
return;
$this->document->appendChild($elm);
}
@ -376,8 +316,7 @@ class Parser {
}
$elm = $this->document->createElement("h".$level);
foreach ($this->parseText() as $node)
if ($node instanceof DOMNode)
$elm->appendChild($node);
$elm->appendChild($node);
$this->document->appendChild($elm);
}
@ -395,10 +334,8 @@ class Parser {
$lang = count($lang) > 0 ? trim($lang[0]->data) : null;
$container = $this->document->createElement("pre");
if ($lang) {
if ($lang)
$container->setAttribute("data-lang", $lang);
$container->setAttribute("class", "language-$lang");
}
$buffer = "";
while (!($this->current()->type === TokenType::BACKTICK &&
@ -413,10 +350,6 @@ class Parser {
}
$elm = $this->document->createElement("code", htmlspecialchars($buffer));
if ($lang) {
$elm->setAttribute("data-lang", $lang);
$elm->setAttribute("class", "language-$lang");
}
$container->appendChild($elm);
$this->document->appendChild($container);
$this->consume();
@ -525,7 +458,7 @@ class Parser {
}
$buffer = "";
$elm = $this->document->createElement("blockquote", $buffer);
while (!($this->current()->type === TokenType::EOF) && !($this->current()->type === TokenType::EOL && $this->next()->type !== TokenType::GT)) {
while (!($this->current()->type === TokenType::EOL && $this->next()->type !== TokenType::GT)) {
$gt = $this->consume();
if ($this->current()->type === TokenType::EOL) {
$this->consume();
@ -562,10 +495,6 @@ class Parser {
while ($this->current()->type !== TokenType::EOF) {
switch($this->current()->type) {
case TokenType::ASTERISK:
if ($this->next()->type === TokenType::ASTERISK) {
$this->buildParagraph($this->parseText(true));
break;
}
$list = $this->parseList();
$this->document->appendChild($list);
break;

@ -22,8 +22,6 @@ enum TokenType {
case PIPE ;
case GT ;
case TAB ;
case LBRACE ;
case RBRACE ;
}
class Token {

@ -1,70 +0,0 @@
<?php declare(strict_types=1);
use PHPUnit\Framework\TestCase;
final class AnnotationsTest extends TestCase {
public function testAnnotationsDoNotBreakHeadings() : void {
$source = "
# This is an H1 {.withAClass}
## This is an H2 {.withAClass}
### This is an H3 {.withAClass}
#### This is an H4 {.withAClass}
##### This is an H5 {.withAClass}
";
$target = "
<h1>This is an H1</h1>
<h2>This is an H2</h2>
<h3>This is an H3</h3>
<h4>This is an H4</h4>
<h5>This is an H5</h5>
";
[$source, $result] = createTest($source, $target);
$this->assertEquals($source, $result);
}
public function testAnnotationsDoNotBreakLists() : void {
$source = "
* this is a list
* with annotations {#someID}
1. this is an ordered list
1. with an annotation {.someClass}
";
$target = "
<ul>
<li>this is a list</li>
<li>with annotations</li>
</ul>
<ol>
<li>
this is an ordered list
<ol>
<li>with an annotation</li>
</ol>
</li>
</ol>
";
[$source, $result] = createTest($source, $target);
$this->assertEquals($source, $result);
}
public function testAnnotationsDoNotBreakCodeblocks() : void {
$source = "
```
this is a code block
``` {.someClass}
";
$target = "
<pre>
<code>this is a code block</code>
</pre>
";
[$source, $result] = createTest($source, $target);
$this->assertEquals($source, $result);
}
}

@ -1,46 +0,0 @@
<?php declare(strict_types=1);
use PHPUnit\Framework\TestCase;
final class CodeBlocksTest extends TestCase {
public function testCodeblocksParseCorrectly() : void {
$source = "
```
this is a code block
```
";
$target = "
<pre>
<code>
this is a code block
</code>
</pre>
";
[$source, $result] = createTest($source, $target);
$this->assertEquals($source, $result);
}
public function testLanguageAnnotationParsesCorrectly() : void {
$source = "
```php
public function testLanguageAnnotationParsesCorrectly() : bool {
return true;
}
```
";
$target = "
<pre data-lang=\"php\" class=\"language-php\">
<code data-lang=\"php\" class=\"language-php\">
public function testLanguageAnnotationParsesCorrectly() : bool {
return true;
}
</code>
</pre>
";
[$source, $result] = createTest($source, $target);
$this->assertEquals($source, $result);
}
}

@ -1,63 +0,0 @@
<?php declare(strict_types=1);
use PHPUnit\Framework\TestCase;
final class GenericBlocksTest extends TestCase {
public function testParagraphParsesCorrectly() : void {
$source = "
this is a paragraph
";
$target = "
<p>
this is a paragraph
</p>
";
[$source, $result] = createTest($source, $target);
$this->assertEquals($source, $result);
}
public function testBlockquotesParseCorrectly() : void {
$source = "
> this is
>
> a blockquote
";
$target = "
<blockquote>
this is <br><br>
a blockquote<br>
</blockquote>
";
[$source, $result] = createTest($source, $target);
$this->assertEquals($source, $result);
}
public function testHorizontalRuleParsesCorrectly() : void {
$source = "
---
";
$target = "<hr>";
[$source, $result] = createTest($source, $target);
$this->assertEquals($source, $result);
}
public function testParagraphAnnotations() : void {
$source = "
this is an annotated paragraph {.classA, .classB}
";
$target = "
<p class=\"classA classB\">
this is an annotated paragraph
</p>
";
[$source, $result] = createTest($source, $target);
$this->assertEquals($source, $result);
}
}

@ -1,65 +0,0 @@
<?php declare(strict_types=1);
use PHPUnit\Framework\TestCase;
final class HeadingsTest extends TestCase {
public function testH1ParsesCorrectly() : void {
$source = "
# This is an H1
";
$target = "
<h1>This is an H1</h1>
";
[$source, $result] = createTest($source, $target);
$this->assertEquals($source, $result);
}
public function testH2ParsesCorrectly() : void {
$source = "
## This is an H2
";
$target = "
<h2>This is an H2</h2>
";
[$source, $result] = createTest($source, $target);
$this->assertEquals($source, $result);
}
public function testH3ParsesCorrectly() : void {
$source = "
### This is an H3
";
$target = "
<h3>This is an H3</h3>
";
[$source, $result] = createTest($source, $target);
$this->assertEquals($source, $result);
}
public function testH4ParsesCorrectly() : void {
$source = "
#### This is an H4
";
$target = "
<h4>This is an H4</h4>
";
[$source, $result] = createTest($source, $target);
$this->assertEquals($source, $result);
}
public function testH5ParsesCorrectly() : void {
$source = "
##### This is an H5
";
$target = "
<h5>This is an H5</h5>
";
[$source, $result] = createTest($source, $target);
$this->assertEquals($source, $result);
}
}

@ -1,84 +0,0 @@
<?php declare(strict_types=1);
use PHPUnit\Framework\TestCase;
final class InlineElementsTest extends TestCase {
public function testBoldParsesCorrectly() : void {
$source = "
Lorem **ipsum** dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor.
";
$target = "
<p>Lorem <b>ipsum</b> dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor.</p>
";
[$source, $result] = createTest($source, $target);
$this->assertEquals($source, $result);
}
public function testItalicParsesCorrectly() : void {
$source = "
Lorem **ipsum** dolor sit amet, *consetetur* sadipscing elitr, sed diam nonumy eirmod tempor.
";
$target = "
<p>Lorem <b>ipsum</b> dolor sit amet, <i>consetetur</i> sadipscing elitr, sed diam nonumy eirmod tempor.</p>
";
[$source, $result] = createTest($source, $target);
$this->assertEquals($source, $result);
}
public function testCodeSnippetsParseCorrectly() : void {
$source = "
Lorem **ipsum** dolor sit amet, *consetetur* sadipscing `elitr`, sed diam nonumy eirmod tempor.
";
$target = "
<p>Lorem <b>ipsum</b> dolor sit amet, <i>consetetur</i> sadipscing <code>elitr</code>, sed diam nonumy eirmod tempor.</p>
";
[$source, $result] = createTest($source, $target);
$this->assertEquals($source, $result);
}
public function testImagesParseCorrectly() : void {
$source = "
![an image](https://massivedynamic.eu/wp-content/themes/massivedynamic/logo_massive_dynamic.png)
Lorem ipsum dolor sit amet.
";
$target = "
<p>
<img alt=\"an image\" src=\"https://massivedynamic.eu/wp-content/themes/massivedynamic/logo_massive_dynamic.png\">
Lorem ipsum dolor sit amet.
</p>
";
[$source, $result] = createTest($source, $target);
$this->assertEquals($source, $result);
}
public function testLinksParseCorrectly() : void {
$source = "
Lorem **ipsum** dolor sit amet, *consetetur* sadipscing `elitr`, [sed diam](https://massivedynamic.eu) nonumy eirmod tempor.
";
$target = "
<p>
Lorem <b>ipsum</b> dolor sit amet, <i>consetetur</i> sadipscing <code>elitr</code>,
<a href=\"https://massivedynamic.eu\">
sed diam
</a>
nonumy eirmod tempor.
</p>
";
[$source, $result] = createTest($source, $target);
$this->assertEquals($source, $result);
}
}

@ -1,59 +0,0 @@
<?php declare(strict_types=1);
use PHPUnit\Framework\TestCase;
final class ListsTest extends TestCase {
public function testUnorderedListsParseCorrectly() : void {
$source = "
* Listpoint A
* Listpoint B
* Subpoint B1
* Subpoint B2
* Listpoint C
";
$target = "
<ul>
<li> Listpoint A</li>
<li>
Listpoint B
<ul>
<li> Subpoint B1</li>
<li> Subpoint B2</li>
</ul>
</li>
<li> Listpoint C</li>
</ul>
";
[$source, $result] = createTest($source, $target);
$this->assertEquals($source, $result);
}
public function testOrderedListsParseCorrectly() : void {
$source = "
1. Listpoint A
2. Listpoint B
1. Subpoint B1
2. Subpoint B2
3. Listpoint C
";
$target = "
<ol>
<li> Listpoint A</li>
<li>
Listpoint B
<ol>
<li> Subpoint B1</li>
<li> Subpoint B2</li>
</ol>
</li>
<li> Listpoint C</li>
</ol>
";
[$source, $result] = createTest($source, $target);
$this->assertEquals($source, $result);
}
}

@ -1,38 +0,0 @@
<?php declare(strict_types=1);
use PHPUnit\Framework\TestCase;
final class ReferencesTest extends TestCase {
public function testSimpleReferencesAreResolvedCorrectly() : void {
$source = "
this text uses [a simple reference][1]
[1]: https://massivedynamic.eu
";
$target = "
<p>
this text uses <a href=\"https://massivedynamic.eu\">a simple reference</a>
</p>
";
[$source, $result] = createTest($source, $target);
$this->assertEquals($source, $result);
}
public function testNamedReferencesAreResolvedCorrectly() : void {
$source = "
this text uses [a simple reference][REF] and does it [twice][REF]
[REF]: https://massivedynamic.eu
";
$target = "
<p>
this text uses <a href=\"https://massivedynamic.eu\">a simple reference</a>
and does it <a href=\"https://massivedynamic.eu\">twice</a>
</p>
";
[$source, $result] = createTest($source, $target);
$this->assertEquals($source, $result);
}
}

@ -1,37 +0,0 @@
<?php declare(strict_types=1);
use PHPUnit\Framework\TestCase;
final class TablesTest extends TestCase {
public function testTableParsesCorrectly() : void {
$source = "
| Product | Amount | Price |
|:--------|:------:|-------:|
| Part A | 5 | 20,00€ |
| Editor | 100 | 39,99€ |
";
$target = "
<table>
<tr>
<th style=\"text-align: left\">Product</th>
<th style=\"text-align: center\">Amount</th>
<th style=\"text-align: right\">Price</th>
</tr>
<tr>
<td style=\"text-align: left\">Part A</td>
<td style=\"text-align: center\">5</td>
<td style=\"text-align: right\">20,00&euro;</td>
</tr>
<tr>
<td style=\"text-align: left\">Editor</td>
<td style=\"text-align: center\">100</td>
<td style=\"text-align: right\">39,99&euro;</td>
</tr>
</table>
";
[$source, $result] = createTest($source, $target);
$this->assertEquals($source, $result);
}
}

@ -0,0 +1,19 @@
* point A
* point B
* sub A
* sub B
* sub sub A
* sub C
* sub D
* point C
* point D
* point E
* point F
1. point 1
2. sub 1
1. sub sub 1
1. sub sub 2
3. sub 2
3. point 2
4. point 3

@ -0,0 +1,2 @@
This is line one.
This is line two.

@ -0,0 +1,39 @@
# Heading 1
#### lol **lol**
* this **bold** and somewhat
* kind of *italic* thing
* is
* a
* list
1. this is
2. an ordered
3. list
Lorem **ipsum** dolor sit *amet*, `consetetur` sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
And we test: all [special chars][1] in random [text][hallo]. this [word][http://lol.de] is a link.
### Testing an Image
**bold** at the beginning
lol 1 bild ![Eine Perle: für **die Ewigkeit* ..](https://mike-ochmann.de/assets/images/perl_jam.jpg)
| Spalte 1 | Spalte 2 | Spalte 3 |
|:---------|-----:----|---------:|
| value a | value b | value c |
At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. {class: rot}
```
//this should be a codeblock
function helloWorld() : void {
echo "Hello World!";
}
helloWorld();
```
[1]: https://these-are-references:0
[hallo]: ulululu

@ -1,12 +0,0 @@
<?php declare(strict_types=1);
use parkdown\Parkdown;
function createTest(string $source, string $target) : array {
$strip = function(string $string) : string {
return trim(preg_replace("/\s+/", "", $string));
};
$parkdown = new Parkdown($source);
return [$strip($target), $strip($parkdown->html())];
}
Loading…
Cancel
Save