2017 © Pedro Peláez
 

library copilot-markdown-generator

Generator classes for Copilot-flavored Markdown tags.

image

conde-nast-international/copilot-markdown-generator

Generator classes for Copilot-flavored Markdown tags.

  • Monday, April 16, 2018
  • by srilq
  • Repository
  • 7 Watchers
  • 0 Stars
  • 153 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 9 Versions
  • 43 % Grown

The README.md

copilot-markdown-generator (PHP)

Generator classes for Copilot-flavored Markdown tags., (*1)

This is a utility library for generating Copilot-flavored Markdown, created for use in PHP implementations of the Flyway Integration API., (*2)

Install

Using Composer:, (*3)

$ composer require conde-nast-international/copilot-markdown-generator

Basic usage

use CopilotTags\Text;

$tag = new Text("Hello world!");
$markdown = $tag->render();
echo $markdown;
// Hello world!

See the example implementation, which shows how the library can be used to convert custom XML content., (*4)

Contributing

See the Contributing document for guidance on making contributions to the project., (*5)

API

This library is a collection of simple Markdown generator classes namespaced in CopilotTags (e.g. CopilotTags\Paragraph)., (*6)

Several of the generators take a text parameter. The given text value can contain any valid Copilot-flavored Markdown, which allows for tags to be nested., (*7)

NOTE: You need to escape any Markdown characters in the source content that should not be treated as Markdown:
, (*8)

addcslashes($content, "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~");

CopilotTag

Interface for tag generator classes. * CopilotTag->render(), (*9)

Render tag object as beautified Copilot-flavored Markdown string.
Return: string (Markdown), (*10)

Text

Generator for unformatted text., (*11)

(new Text("Hello world!"))->render();
// "Hello world!"
  • new Text($text)
    text: string (Markdown)

Heading

Generator for ATX headings., (*12)

(new Heading("Hello world!", 3))->render();
// "\n\n### Hello world!\n"
  • new Heading($text[, $level])
    text: string (Markdown)
    level: int (default: 2) (min: 2) (max: 4)

Paragraph

Generator for paragraphs., (*13)

(new Paragraph("Hello world!"))->render();
// "\n\nHello world!\n\n"
  • new Paragraph($text)
    text: string (Markdown)

InlineText

Generator for inline text tags: emphasis, strong and delete., (*14)

(new InlineText("Hello world!", InlineTextDelimiter::EMPHASIS))->render();
// "*Hello world!*"
  • new InlineText($text[, $delimiter])
    text: string (Markdown)
    delimiter: string (InlineTextDelimiter) (default: "")

InlineTextDelimiter

Class Constant Value Also known as
EMPHASIS * Italic, em
STRONG ** Bold
DELETE ~~ Strikethrough, strike, del

Generator for links., (*15)

(new Link("Hello world!", "https://github.com/"))->render();
// "[Hello world!](https://github.com/)"
(new Link("Hello world!", "https://github.com/", array("rel"=>"nofollow")))->render();
// "[Hello world!](https://github.com/){: rel=\"nofollow\" }"
  • new Link([$text, $href, $attributes])
    text: string (Markdown) (default: "")
    href: string (default: "")
    attributes: array (default: [])

Blockquote

Generator for block quotes., (*16)

(new Blockquote("Hello world!"))->render();
// "\n> Hello world!\n"
  • new Blockquote($text)
    text: string (Markdown)

ListTag

Generator for lists., (*17)

(new ListTag(["First", "Second"]))->render();
// "\n\n* First\n* Second\n\n"
(new ListTag(["First", "Second"], TRUE))->render();
// "\n\n1. First\n2. Second\n\n"
  • new ListTag($items[, $ordered])
    items: array (Markdown)
    ordered: boolean (default: FALSE)

Embed

Generator for embeds., (*18)

(new Embed("https://github.com", EmbedSubtype::IFRAME))->render();
// "\n\n[#iframe: https://github.com]\n\n"
(new Embed("https://github.com", EmbedSubtype::IFRAME, "My caption."))->render();
// "\n\n[#iframe: https://github.com]|||My caption.|||\n\n"
  • new Embed($uri[, $subtype, $caption])
    uri: string
    subtype: string (default: EmbedSubtype::IFRAME)
    caption: string (default: "")

EmbedSubtype

Class constants for valid embed subtypes. See the source file for reference., (*19)

See also

The Versions

16/04 2018

dev-master

9999999-dev https://github.com/conde-nast-international/copilot-markdown-generator-php

Generator classes for Copilot-flavored Markdown tags.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

api parser php composer library generator tags markdown converter integration commonmark converters copilot markdown copilot markdown generator copilot flavored markdown copilot flavoured markdown generater markdown tags copilot copilot tags flyway flyway integration flyway integration api content parser content converter content converters tugboat conde nast conde nast international cni

16/04 2018

dev-test/inline-link-spacing

dev-test/inline-link-spacing https://github.com/conde-nast-international/copilot-markdown-generator-php

Generator classes for Copilot-flavored Markdown tags.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

api parser php composer library generator tags markdown converter integration commonmark converters copilot markdown copilot markdown generator copilot flavored markdown copilot flavoured markdown generater markdown tags copilot copilot tags flyway flyway integration flyway integration api content parser content converter content converters tugboat conde nast conde nast international cni

23/01 2018

v0.2.0

0.2.0.0 https://github.com/conde-nast-international/copilot-markdown-generator-php

Generator classes for Copilot-flavored Markdown tags.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

api parser php composer library generator tags markdown converter integration commonmark converters copilot markdown copilot markdown generator copilot flavored markdown copilot flavoured markdown generater markdown tags copilot copilot tags flyway flyway integration flyway integration api content parser content converter content converters tugboat conde nast conde nast international cni

15/01 2018

v0.1.0

0.1.0.0 https://github.com/conde-nast-international/copilot-markdown-generator-php

Generator classes for Copilot-flavored Markdown tags.

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

api parser php composer library generator tags markdown converter integration commonmark converters copilot markdown copilot markdown generator copilot flavored markdown copilot flavoured markdown generater markdown tags copilot copilot tags flyway flyway integration flyway integration api content parser content converter content converters tugboat conde nast conde nast international cni

10/01 2018

dev-srilq/embeds

dev-srilq/embeds https://github.com/conde-nast-international/copilot-markdown-generator-php

Generator classes for Copilot-flavored Markdown tags.

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

api parser php composer library generator tags markdown converter integration commonmark converters copilot markdown copilot markdown generator copilot flavored markdown copilot flavoured markdown generater markdown tags copilot copilot tags flyway flyway integration flyway integration api content parser content converter content converters tugboat conde nast conde nast international cni

15/12 2017

dev-srilq/example-implementation

dev-srilq/example-implementation https://github.com/conde-nast-international/copilot-markdown-generator-php

Generator classes for Copilot-flavored Markdown tags.

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

api parser php composer library generator tags markdown converter integration commonmark converters copilot markdown copilot markdown generator copilot flavored markdown copilot flavoured markdown generater markdown tags copilot copilot tags flyway flyway integration flyway integration api content parser content converter content converters tugboat conde nast conde nast international cni

15/12 2017

dev-more-tags

dev-more-tags https://github.com/conde-nast-international/copilot-markdown-generator-php

Generator classes for Copilot-flavored Markdown tags.

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

api parser php composer library generator tags markdown converter integration commonmark converters copilot markdown copilot markdown generator copilot flavored markdown copilot flavoured markdown generater markdown tags copilot copilot tags flyway flyway integration flyway integration api content parser content converter content converters tugboat conde nast conde nast international cni

06/12 2017

v0.0.2

0.0.2.0 https://github.com/conde-nast-international/copilot-markdown-generator-php

Generator classes for Copilot-flavored Markdown tags.

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

06/12 2017

v0.0.1

0.0.1.0 https://github.com/conde-nast-international/copilot-markdown-generator-php

Generator classes for Copilot-flavored Markdown tags.

  Sources   Download

MIT

The Requires

  • php >=5.6.0