diff --git a/composer.json b/composer.json index d0d57b2..8d0dadb 100644 --- a/composer.json +++ b/composer.json @@ -1,18 +1,19 @@ { - "name": "makotokw/wp-gfm", - "authors": [ - { - "name": "Makoto Kawasaki", - "email": "makoto.kw@gmail.com" - } - ], - "require": { - "php": ">=5.3", - "michelf/php-markdown": "1.6.*@dev" - }, - "autoload": { - "psr-0": { - "": "src/" - } - } + "name": "makotokw/wp-gfm", + "license": "MIT", + "authors": [ + { + "name": "Makoto Kawasaki", + "email": "makoto.kw@gmail.com" + } + ], + "require": { + "php": ">=5.3", + "michelf/php-markdown": "1.7.*@dev" + }, + "autoload": { + "psr-0": { + "Gfm\\Markdown\\": "src/" + } + } } diff --git a/composer.lock b/composer.lock index 96a5392..8ffc980 100644 --- a/composer.lock +++ b/composer.lock @@ -4,21 +4,21 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "482abbcb3fdd074990ca8a9e46fb32af", - "content-hash": "99309a71b2bc5d239b0520343746043f", + "hash": "49e78f2be6061f0cf7bff5700b27472b", + "content-hash": "f510365075fee3e3f690c40f6348c35d", "packages": [ { "name": "michelf/php-markdown", - "version": "1.6.0", + "version": "1.7.0", "source": { "type": "git", "url": "https://github.com/michelf/php-markdown.git", - "reference": "156e56ee036505ec637d761ee62dc425d807183c" + "reference": "1f51cc520948f66cd2af8cbc45a5ee175e774220" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/michelf/php-markdown/zipball/156e56ee036505ec637d761ee62dc425d807183c", - "reference": "156e56ee036505ec637d761ee62dc425d807183c", + "url": "https://api.github.com/repos/michelf/php-markdown/zipball/1f51cc520948f66cd2af8cbc45a5ee175e774220", + "reference": "1f51cc520948f66cd2af8cbc45a5ee175e774220", "shasum": "" }, "require": { @@ -56,7 +56,7 @@ "keywords": [ "markdown" ], - "time": "2015-12-24 01:37:31" + "time": "2016-10-29 18:58:20" } ], "packages-dev": [], diff --git a/css/markdown.css b/css/markdown.css index 3e8d441..09d16eb 100644 --- a/css/markdown.css +++ b/css/markdown.css @@ -1,16 +1,20 @@ +/* line 2, ../sass/_typography.scss */ .markdown-content h1, .markdown-content h2, .markdown-content h3, .markdown-content h4, .markdown-content h5, .markdown-content h6 { clear: none; outline: none; } +/* line 7, ../sass/_typography.scss */ .markdown-content .footnotes hr { margin-bottom: 4px; } +/* line 10, ../sass/_typography.scss */ .markdown-content .footnotes ol { padding: 0; margin: 0 0 0 20px; font-size: .8em; } +/* line 1, ../sass/_toc.scss */ .wp-gfm-toc-content { background-color: #fefefe; border: 1px solid #ddd; @@ -22,34 +26,42 @@ display: table; } +/* line 13, ../sass/_toc.scss */ .wp-gfm-toc-content > ul { margin-top: 15px; } +/* line 16, ../sass/_toc.scss */ .wp-gfm-toc-content ul { padding: 0; margin: 0 0 0 20px; } +/* line 20, ../sass/_toc.scss */ .wp-gfm-toc-content li { margin: 0; font-size: 12px; } +/* line 23, ../sass/_toc.scss */ .wp-gfm-toc-content li li { margin-left: 1.5em; font-size: 10px; } +/* line 28, ../sass/_toc.scss */ .wp-gfm-toc-content a { color: #333; text-decoration: none; } +/* line 31, ../sass/_toc.scss */ .wp-gfm-toc-content a:hover { text-decoration: underline; } +/* line 35, ../sass/_toc.scss */ .wp-gfm-toc-content.right { float: right; margin-left: 12px; margin-right: 0; width: auto; } +/* line 42, ../sass/_toc.scss */ .wp-gfm-toc-content.left { float: left; margin-right: 12px; @@ -57,32 +69,51 @@ width: auto; } -.wp-gfm-ad { +/* line 1, ../sass/_footer.scss */ +.wp-gfm-footer { margin: 5px 0; + clear: both; +} + +/* line 5, ../sass/_footer.scss */ +.wp-gfm-ad { + display: inline; + float: right; font-size: 12px; text-align: right; - clear: both; } +/* line 10, ../sass/_footer.scss */ .wp-gfm-ad .wp-gfm-powered-by { - color: #999; + color: #767676; +} +/* line 13, ../sass/_footer.scss */ +.wp-gfm-ad img { + margin: 0; +} +/* line 16, ../sass/_footer.scss */ +.wp-gfm-ad a { + font-weight: bold; } +/* line 1, ../sass/_embed.scss */ .markdown-file { position: relative; border: 1px solid #dedede; border-radius: 3px; margin: 1em 0; } +/* line 7, ../sass/_embed.scss */ .markdown-file .markdown-body { padding: 20px; } +/* line 11, ../sass/_embed.scss */ .markdown-file .markdown-meta { + clear: both; display: block; padding: 9px 10px 10px; margin: 0; font-size: 14px; line-height: 17px; background-color: #f5f5f5; - border: 1px solid #d8d8d8; - border-bottom: 0; + border-top: 1px solid #dedede; } diff --git a/markdown.php b/markdown.php index 342ac17..223447f 100644 --- a/markdown.php +++ b/markdown.php @@ -9,8 +9,7 @@ License: MIT */ -class WP_GFM -{ +class WP_GFM { const NAME = 'WP_GFM'; const VERSION = '0.8'; const DEFAULT_RENDER_URL = 'https://api.github.com/markdown/raw'; @@ -18,10 +17,11 @@ class WP_GFM // google-code-prettify: https://code.google.com/p/google-code-prettify/ const FENCED_CODE_BLOCKS_TEMPLATE_FOR_GOOGLE_CODE_PRETTIFY = '
{{codeblock}}
'; - public $agent = ''; - public $url = ''; + public $agent = ''; + public $url = ''; public $has_converter = false; - public $gfm_options = array(); + public $gfm_options = array(); + public $ad_html = ''; static function get_instance() { static $plugin = null; @@ -53,6 +53,8 @@ private function __construct() { } else { add_action( 'wp_enqueue_scripts', array( $this, 'wp_enqueue_styles' ) ); } + + $this->ad_html = '
Markdown with by ❤ wp-gfm
'; } function wp_enqueue_styles() { @@ -237,6 +239,12 @@ function shortcode_markdown( /** @noinspection PhpUnusedParameterInspection */ $ return $content; } + /** + * @param $use_gfm + * @param $atts + * @param $content + * @return string + */ function shortcode_embed( $use_gfm, $atts, /** @noinspection PhpUnusedParameterInspection */ $content ) { /** * @var string $url @@ -260,15 +268,10 @@ function shortcode_embed( $use_gfm, $atts, /** @noinspection PhpUnusedParameterI $url = '' . $url . ''; } - if ( $use_gfm ) { - return '
' - . $this->shortcode_gfm( $atts, $body ) - . '
' . $url . '
'; - } else { - return '
' - . $this->shortcode_markdown( $atts, $body ) - . '
' . $url . '
'; - } + return '
' + . ($use_gfm ? $this->shortcode_gfm( $atts, $body ) : $this->shortcode_markdown( $atts, $body )) + . '
' . $url . $this->ad_html . '
' + . '
'; } return ''; } @@ -302,7 +305,7 @@ function the_content( $content ) { function the_content_ad( $context ) { if ( strpos( $context, '
' ) !== false ) { - return $context . '
Markdown with by wp-gfm
'; + return $context . ''; } return $context; } @@ -357,7 +360,8 @@ function admin_quicktags() {