From 7f70681411044e6554ca343ace9210a3ea2d922a Mon Sep 17 00:00:00 2001 From: Michael Ochmann Date: Mon, 28 Feb 2022 17:01:03 +0100 Subject: [PATCH] added readme as test --- README.md | 90 +++++++++++++++++++++++++++++++++++++++++++++++ index.php | 9 +++-- src/Parser.php | 2 +- test/paragraph.md | 2 ++ 4 files changed, 100 insertions(+), 3 deletions(-) create mode 100644 README.md create mode 100644 test/paragraph.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..6604c40 --- /dev/null +++ b/README.md @@ -0,0 +1,90 @@ +# Parkdown +– a simple recursive descent Markdown parser for PHP + +![Markdown is a simple markup language](https://upload.wikimedia.org/wikipedia/commons/4/48/Markdown-mark.svg) + +## Specification + +### Supported block types +Parkdown currently support the following block types: + +* codeblocks *(with the ability to specify a language for the code block)* +* tables *(with alignment specification)* +* paragraphs + +### Supported inline types +Parkdown currently support the following block types: + +* bold text (`**bold**`) +* italic text (`*italic*`) +* code snippets +* images (`![alt text](src url)`) +* links (`[link text][url or reference]`) + +### Additional functionality + +* references (`[marker]: URL`) + +## Examples + +### 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], 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], i we so desire. + +### Images +```markdown +\!\[this is an alt text\]\(https://images.unsplash.com/photo-1571171637578-41bc2dd41cd2?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&h=300&w=1740&q=80\) +``` + +![this is an alt text](https://images.unsplash.com/photo-1571171637578-41bc2dd41cd2?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&h=300&w=1740&q=80) + +### Code blocks +```markdown + +\`\`\`php + function main(int $argc, array $argv) : int { + echo "Hello World!"; + + return 0; + } +\`\`\` + +``` + +```php + function main(int $argc, array $argv) : int { + echo "Hello World!"; + + return 0; + } +``` + +### Tables +```markdown +| Product name | Amount | Price | +|--------------|-----:----|-------:| +| Football | 7 | $18,00 | +| Golfball | 122 | $7,00 | +| Fooseball | 355 | $1,00 | +| Puck | 58 | $12,00 | +``` + +| Product name | Amount | Price | +|--------------|-----:----|-------:| +| Football | 7 | $18,00 | +| Golfball | 122 | $7,00 | +| Fooseball | 355 | $1,00 | +| Puck | 58 | $12,00 | + +### References + +```markdown +[massivedynamic]: https://massivedynamic.eu +``` + +[massivedynamic]: https://massivedynamic.eu \ No newline at end of file diff --git a/index.php b/index.php index ad0699d..23c4906 100644 --- a/index.php +++ b/index.php @@ -3,10 +3,15 @@ require __DIR__."/vendor/autoload.php"; -$source = file_get_contents(dirname(__FILE__)."/test/test1.md"); +$source = file_get_contents(dirname(__FILE__)."/README.md"); +//$source = file_get_contents(dirname(__FILE__)."/test/paragraph.md"); echo "