|
1 | 1 | # gen-md |
2 | 2 | PHP Library for generating Markdown document |
| 3 | + |
| 4 | + |
| 5 | +[](https://github.com/ABGEO07/gen-md/blob/master/LICENSE) |
| 6 | + |
| 7 | +[](https://github.com/ABGEO07/gen-md/releases) |
| 8 | + |
| 9 | +[](https://packagist.org/packages/abgeo/gen-md "Packagist Version") |
| 10 | + |
| 11 | +--- |
| 12 | + |
| 13 | +## Installation |
| 14 | + |
| 15 | +You can install this library with [Composer](https://getcomposer.org/): |
| 16 | + |
| 17 | +- `composer require abgeo/gen-md` |
| 18 | + |
| 19 | +## Usage |
| 20 | + |
| 21 | +Include composer autoloader in your main file (Ex.: index.php) |
| 22 | + |
| 23 | +- `require_once __DIR__ . '/../vendor/autoload.php';` |
| 24 | + |
| 25 | +### Classes |
| 26 | + |
| 27 | +The library has two classes: |
| 28 | + |
| 29 | +* `\ABGEO\MDGenerator\Document` - For generating Markdown Document; |
| 30 | +* `\ABGEO\MDGenerator\Element` - For generating Markdown element; |
| 31 | + |
| 32 | +#### Class `Document` |
| 33 | + |
| 34 | +Import `ABGEO\MDGenerator\Document` class. |
| 35 | + |
| 36 | +##### Public Methods |
| 37 | + |
| 38 | +- `addElement()` - Add element to Document content; |
| 39 | +- `clear()` -Clear Document content; |
| 40 | + |
| 41 | +**Note: See usage in [example.php](examples/example.php)** |
| 42 | + |
| 43 | +#### Class `Element` |
| 44 | + |
| 45 | +Import `ABGEO\MDGenerator\Element` class. |
| 46 | + |
| 47 | +##### Public Methods |
| 48 | + |
| 49 | +- `concatenateElements()` - Concatenate given elements; |
| 50 | +- `createHeading()` - Create heading element; |
| 51 | +- `createParagraph()` - Create Paragraph element; |
| 52 | +- `createBreak()` - Create Line Break element; |
| 53 | +- `createBold()` - Create Bold element; |
| 54 | +- `createItalic()` - Create Italic element; |
| 55 | +- `createBoldAndItalic()` - Create Bold and Italic element; |
| 56 | +- `createBlockquote()` - Create Blockquote element; |
| 57 | +- `createList()` - Create List element; |
| 58 | +- `createLine()` - Create Line element; |
| 59 | +- `createLink()` - Create Link element; |
| 60 | +- `createImage()` - Create Image element; |
| 61 | + |
| 62 | +**Note: See usage in [example.php](examples/example.php)** |
| 63 | + |
| 64 | +### Exporting |
| 65 | + |
| 66 | +The `ABGEO\MDGenerator\Document` class has `export2File()` method that takes one argument |
| 67 | +- File path for generated document. |
| 68 | + |
| 69 | +### Example |
| 70 | + |
| 71 | +```php |
| 72 | +... |
| 73 | +// Export document to file. |
| 74 | +$document->export2File(__DIR__ . '/generated/example.MD'); |
| 75 | +... |
| 76 | +``` |
| 77 | + |
| 78 | +## Examples |
| 79 | + |
| 80 | +See full example in [example.php](examples/example.php). |
| 81 | + |
| 82 | +## Authors |
| 83 | + |
| 84 | +* **Temuri Takalandze** - *Initial work* - [ABGEO](https://abgeo.dev) |
| 85 | + |
| 86 | +## License |
| 87 | + |
| 88 | +This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details |
0 commit comments