2017 © Pedro Peláez
 

library php-markup

A super basic library to generate markup code

image

crecket/php-markup

A super basic library to generate markup code

  • Thursday, September 22, 2016
  • by Crecket
  • Repository
  • 1 Watchers
  • 0 Stars
  • 15 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

php-markup

Create markup code suitable for reddit., (*1)

Examples

use Crecket\PHPMarkup\Format;

$markup = new \Crecket\PHPMarkup\Markup();

// a table with some text and custom headers
$markup->table(

    // a array with list of the column names
    array(
        Format\Italic::get('italic column header'),
        Format\Strike::get('bad column'),
        'column3'
    ),

    // a array with rows in it
    array(

        // a array with data for the first row
        array(
            rand(1, 1000),
            rand(1, 1000),
            rand(1, 1000),
        ),

        // a array with data for the second row
        array(
            rand(1, 1000),
            rand(1, 1000),
            rand(1, 1000),
        ),
    )
);

// new line
$markup->newLine();

// basic link
$markup->link('a title for my link', 'https://www.masterypoints.com');

// titles
$markup->line(Format\Title1::get('title1'), true);
$markup->line(Format\Title2::get('title2'), true);
$markup->line(Format\Title3::get('title3'), true);
$markup->line(Format\Title4::get('title4'), true);

// basic b/i/s formatting
$markup->line(Format\Italic::get('italic text'), true);
$markup->line(Format\Bold::get('bold text'), true);
$markup->line(Format\Strike::get('strike through text'), true);

// automatically makes sure all words are super script
$markup->line(Format\SuperScript::get('super script text'), true);

// code formatting
$markup->line(Format\Formatted::get("formatted text \nmultiline \ncode"), true);

// code inline formatting variation
$markup->line(Format\InlineFormatted::get('inline formatted text'), true);

// escape any special characters
$markup->line(Format\Escaped::get('*escaped special characters*'), true);

// a qouted multi line text
$markup->line(Format\Qoute::get("wew I'm important \n\- some important dude"), true);

// get result
$markup_result = $markup->get();

This results in:, (*2)

italic column header|~~bad column~~|column3 ---|---|--- 581|85|624 740|421|981 a title for my link, (*3)

title1

title2

title3

title4

italic text, (*4)

bold text, (*5)

~~strike through text~~, (*6)

^super ^script ^text, (*7)

formatted text 
multiline 
code

inline formatted text, (*8)

*escaped special characters*, (*9)

wew I'm important, (*10)

- some important dude, (*11)

The Versions

22/09 2016

dev-master

9999999-dev https://github.com/Crecket/php-markup

A super basic library to generate markup code

  Sources   Download

WTFPL

The Requires

  • php >=5.5.0

 

by Gregory Goijaerts

22/09 2016

1.0.0

1.0.0.0 https://github.com/Crecket/php-markup

A super basic library to generate markup code

  Sources   Download

WTFPL

The Requires

  • php >=5.5.0

 

by Gregory Goijaerts