PHP Classes

PHP Markdown Generator: Compose and generate Markdown documents

Recommend this page to a friend!
  Info   View files Example   View files View files (9)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog (1)    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 94 All time: 9,722 This week: 263Up
Version License PHP version Categories
gen-md 1.0.0Custom (specified...5PHP 5, Files and Folders, Printing
Description Author

This package can compose and generate Markdown documents.

It provides a document class that can generate Markdown documents by adding different document elements like paragraphs, headings, lists, text formatted with styles, etc.

The package also provides a trait that can export the generated document to a file with a given path. The trait creates the directory of the output file path if it does not exist.

Innovation Award
PHP Programming Innovation award winner
August 2020
Winner


Prize: One official elePHPant Plush Mascott
Markdown became a popular file format to represent documents that can be displayed in plain text format, or in HTML Web pages or other document formats.

This package provides a solution to compose documents in a programmatic way, so it can output the document content in Markdown format.

Manuel Lemos
Picture of Temuri Takalandze
  Performance   Level  
Name: Temuri Takalandze <contact>
Classes: 6 packages by
Country: Georgia Georgia
Innovation award
Innovation award
Nominee: 4x

Winner: 1x

Details

gen-md

PHP Library for generating Markdown document

GitHub license

GitHub release

Packagist Version

Installation

You can install this library with Composer:

  • `composer require abgeo/gen-md`

Usage

Include composer autoloader in your main file (Ex.: index.php)

  • `require_once __DIR__ . '/../vendor/autoload.php';`

Classes

The library has two classes:

  • `\ABGEO\MDGenerator\Document` - For generating Markdown Document;
  • `\ABGEO\MDGenerator\Element` - For generating Markdown element;

Class Document

Import ABGEO\MDGenerator\Document class.

Public Methods

  • `addElement()` - Add element to Document content;
  • `clear()` -Clear Document content;

Note: See usage in example.php

Class Element

Import ABGEO\MDGenerator\Element class.

Public Methods

  • `concatenateElements()` - Concatenate given elements;
  • `createHeading()` - Create heading element;
  • `createParagraph()` - Create Paragraph element;
  • `createBreak()` - Create Line Break element;
  • `createBold()` - Create Bold element;
  • `createItalic()` - Create Italic element;
  • `createBoldAndItalic()` - Create Bold and Italic element;
  • `createBlockquote()` - Create Blockquote element;
  • `createList()` - Create List element;
  • `createLine()` - Create Line element;
  • `createLink()` - Create Link element;
  • `createImage()` - Create Image element;

Note: See usage in example.php

Exporting

The ABGEO\MDGenerator\Document class has export2File() method that takes one argument - File path for generated document.

Example

...
// Export document to file.
$document->export2File(__DIR__ . '/generated/example.MD');
...

Examples

See full example in example.php.

Authors

  • Temuri Takalandze - Initial work - ABGEO

License

This project is licensed under the MIT License - see the LICENSE file for details

  Files folder image Files  
File Role Description
Files folder image.github (1 file)
Files folder imageexamples (1 file, 1 directory)
Files folder imagesrc (1 directory)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  .github  
File Role Description
  Accessible without login Plain text file FUNDING.yml Data Auxiliary data

  Files folder image Files  /  examples  
File Role Description
Files folder imagegenerated (1 file)
  Accessible without login Plain text file example.php Example Example script

  Files folder image Files  /  examples  /  generated  
File Role Description
  Accessible without login Plain text file example.MD Data Auxiliary data

  Files folder image Files  /  src  
File Role Description
Files folder imageMDGenerator (3 files)

  Files folder image Files  /  src  /  MDGenerator  
File Role Description
  Plain text file Document.php Class Class source
  Plain text file Element.php Class Class source
  Plain text file ExporterTrait.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:94
This week:0
All time:9,722
This week:263Up
For more information send a message to info at phpclasses dot org.