Skip to content

Commit de3c605

Browse files
committed
use md_extra
1 parent a522b2b commit de3c605

File tree

1 file changed

+2
-39
lines changed

1 file changed

+2
-39
lines changed

jekyll-export.php

+2-39
Original file line numberDiff line numberDiff line change
@@ -168,13 +168,12 @@ function convert_terms( $post ) {
168168
function convert_posts() {
169169

170170
foreach ( $this->get_posts() as $postID ) {
171-
$md = new Markdownify( null, false, $this->extra_html_include );
171+
$md = new Markdownify_Extra( null, false, $this->extra_html_include );
172172
$post = get_post( $postID );
173173
$meta = array_merge( $this->convert_meta( $post ), $this->convert_terms( $postID ) );
174174
$output = Spyc::YAMLDump($meta);
175175
$output .= "---\n";
176-
$body = $md->parseString( apply_filters( 'the_content', $post->post_content ) );
177-
$output .= $this->convert_links( $body );
176+
$output .= $md->parseString( apply_filters( 'the_content', $post->post_content ) );
178177
$this->write( $output, $post );
179178
}
180179

@@ -414,42 +413,6 @@ function copy_recursive($source, $dest) {
414413

415414
}
416415

417-
/**
418-
* Manually convert links to markdown because markdownify does it in a really strange way
419-
*/
420-
function convert_links( $body ) {
421-
422-
//disabeled for now
423-
return $body;
424-
425-
//links = in body, footnotes = below body
426-
preg_match_all( '/\[([^\]]+?)\]\[([0-9]+)\]/', $body, $links, PREG_SET_ORDER );
427-
preg_match_all( '/\[([0-9]+)\]: (.+)/', $body, $footnotes, PREG_SET_ORDER );
428-
429-
$find = array();
430-
$replace = array();
431-
432-
//build find and replace array
433-
foreach ( $links as $key => $link ) {
434-
435-
$find[] = '#' . preg_quote( $link[0], '#' ) . '#';
436-
$replace[] = "[{$link[1]}]({$footnotes[$key][2]})";
437-
}
438-
439-
//clear out footnotes
440-
foreach ( $footnotes as $footnote ) {
441-
442-
$find[] = '#' . preg_quote( $footnote[0], '#' ) . '#';
443-
$replace[] = '';
444-
445-
}
446-
447-
$body = trim( preg_replace( $find, $replace, $body ) );
448-
449-
return $body;
450-
451-
}
452-
453416
}
454417

455418

0 commit comments

Comments
 (0)