Compare commits
26 Commits
feature/te
...
master
Author | SHA1 | Date |
---|---|---|
|
0cc7b0dd45 | 3 years ago |
|
c7dcd85cce | 3 years ago |
|
efa8516a67 | 3 years ago |
|
507e1e4d26 | 3 years ago |
|
e6ba398b14 | 3 years ago |
|
e37050c3f4 | 3 years ago |
|
496034258a | 3 years ago |
|
4e1e44a41b | 3 years ago |
|
b71dd1d440 | 3 years ago |
|
e841ca30ad | 3 years ago |
|
1aa376d6ec | 3 years ago |
|
9d407c3706 | 3 years ago |
|
6100cf0f6b | 3 years ago |
|
499b2b6fe4 | 3 years ago |
|
8408d735dc | 3 years ago |
|
d6f4545325 | 3 years ago |
|
39307e24e9 | 3 years ago |
|
08ea243729 | 3 years ago |
|
1bca2ac15c | 3 years ago |
|
d7e17e59df | 3 years ago |
|
289d68fa2f | 3 years ago |
|
abb2dbc690 | 3 years ago |
|
859e4801ab | 3 years ago |
|
35dbd30681 | 3 years ago |
|
aefa51e96c | 3 years ago |
|
b0cb237b22 | 3 years ago |
12 changed files with 345 additions and 15 deletions
@ -0,0 +1,35 @@ |
||||
# 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 |
@ -0,0 +1,18 @@ |
||||
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. |
@ -0,0 +1,70 @@ |
||||
<?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); |
||||
} |
||||
} |
@ -0,0 +1,65 @@ |
||||
<?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); |
||||
} |
||||
} |
Loading…
Reference in new issue