Skip to content

Commit 0f5c0fe

Browse files
committed
v1.1 changes
1 parent b7c8940 commit 0f5c0fe

6 files changed

Lines changed: 65 additions & 11 deletions

File tree

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"require": {
33
"erusev/parsedown": "^1.7",
4-
"symfony/yaml": "^5.1"
4+
"symfony/yaml": "^5.1",
5+
"erusev/parsedown-extra": "^0.8.1"
56
}
67
}

composer.lock

Lines changed: 48 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

git-it-write.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
Description: Publish markdown files present in a Github repository as posts to WordPress automatically
66
Author: Aakash Chakravarthy
77
Author URI: https://www.aakashweb.com/
8-
Version: 1.0.1
8+
Version: 1.1
99
*/
1010

11-
define( 'GIW_VERSION', '1.0.1' );
11+
define( 'GIW_VERSION', '1.1' );
1212
define( 'GIW_PATH', plugin_dir_path( __FILE__ ) ); // All have trailing slash
1313
define( 'GIW_ADMIN_URL', trailingslashit( plugin_dir_url( __FILE__ ) . 'admin' ) );
1414

includes/parsedown.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Symfony\Component\Yaml\Yaml;
66

7-
class GIW_Parsedown extends Parsedown{
7+
class GIW_Parsedown extends ParsedownExtra{
88

99
public $default_front_matter = array(
1010
'title' => '',
@@ -16,15 +16,16 @@ class GIW_Parsedown extends Parsedown{
1616

1717
public $uploaded_images = array();
1818

19-
public function text( $text ){
19+
// Parses the front matter and the markdown from the content
20+
public function parse_content( $text ){
2021

2122
$pattern = '/^[\s\r\n]?---[\s\r\n]?$/sm';
2223
$parts = preg_split( $pattern, PHP_EOL.ltrim( $text ) );
2324

2425
if ( count( $parts ) < 3 ) {
2526
return array(
2627
'front_matter' => $this->default_front_matter,
27-
'html' => parent::text( $text )
28+
'markdown' => $text
2829
);
2930
}
3031

@@ -35,7 +36,7 @@ public function text( $text ){
3536

3637
return array(
3738
'front_matter' => $front_matter,
38-
'html' => parent::text( $markdown )
39+
'markdown' => $markdown
3940
);
4041

4142
}

includes/publisher.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,11 @@ public function create_post( $post_id, $item_slug, $item_props, $parent ){
119119
return false;
120120
}
121121

122-
$parsed_content = $this->parsedown->text( $item_content );
122+
$parsed_content = $this->parsedown->parse_content( $item_content );
123+
123124
$front_matter = $parsed_content[ 'front_matter' ];
124-
$content = GIW_Utils::process_content_template( $this->content_template, $parsed_content[ 'html' ] );
125+
$html = $this->parsedown->text( $parsed_content[ 'markdown' ] );
126+
$content = GIW_Utils::process_content_template( $this->content_template, $html );
125127

126128
// Get post details
127129
$post_title = empty( $front_matter[ 'title' ] ) ? $item_slug : $front_matter[ 'title' ];

readme.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ License: GPLv2 or later
88
Requires PHP: 5.3
99
Requires at least: 4.4
1010
Tested up to: 5.5
11-
Stable tag: 1.0.1
11+
Stable tag: 1.1
1212

1313
Publish markdown files present in a Github repository as posts to WordPress automatically
1414

@@ -132,6 +132,9 @@ Yes, if you want to pull posts from the a folder in a repository then you can sp
132132

133133
## Changelog
134134

135+
### 1.1
136+
* New: Support for Parsedown extra
137+
135138
### 1.0.1
136139
* Fix: Webhook is changed to `POST` method.
137140
* Fix: Readme formatting.

0 commit comments

Comments
 (0)