complete rewrite with somewhat more proper support of markdown syntax and more compliant token search

This commit is contained in:
Yessiest 2024-02-26 04:07:10 +04:00
parent 38e0ee2dfb
commit 75c4c11205
3 changed files with 453 additions and 578 deletions

File diff suppressed because it is too large Load Diff

View File

@ -89,7 +89,7 @@ module MDPP
line = word
next
end
line = [line, word].join(' ')
line = [line, word].join(line.end_with?("\n") ? '' : ' ')
end
output.append(line.lstrip)
output.join("\n")

39
test.md
View File

@ -6,16 +6,48 @@
> Block quote **bold** and *italics* test
> Block quote **bold *italics* mix** test
> Nested block quote test
> > with a very stupid secondary quote syntax
this should end the block quote btw
## Header level 2
also header level 2
---
also header level 1
===
not a header level2
---asdlkashdlkasjd
not a header level1
===asdajlsdkjlsd
not a header level2
---
not a header level1
===
[link](http://example.com)
![image alt text](http://example.com)
```plaintext
``` plaintext
code *block*
eat my shit
```
> It is also of importance to note that this code is a hello world program,
> written entirely in C++.
>
> ```cpp
> int main() {
> cout << "Hello **world!**";
> }
> ```
> theoretical failure test case
> **bold** **with space**
paragraph with ``inline code block``
- Unordered list element 1
@ -24,6 +56,11 @@ paragraph with ``inline code block``
1. Ordered list element 1
2. Ordered list element 2
1. [Link](https://ass.com)
2. [Lv2](https://ass.com)
3. [Lv2](https://anus.com)
4. shit
This is not a list
- because it continues the paragraph
- this is how it should be, like it or not