summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jetpack/modules/markdown/easy-markdown.php')
-rw-r--r--plugins/jetpack/modules/markdown/easy-markdown.php43
1 files changed, 42 insertions, 1 deletions
diff --git a/plugins/jetpack/modules/markdown/easy-markdown.php b/plugins/jetpack/modules/markdown/easy-markdown.php
index d218a664..43b41c20 100644
--- a/plugins/jetpack/modules/markdown/easy-markdown.php
+++ b/plugins/jetpack/modules/markdown/easy-markdown.php
@@ -294,6 +294,15 @@ class WPCom_Markdown {
* @return string support url
*/
protected function get_support_url() {
+ /**
+ * Filter the Markdown support URL.
+ *
+ * @module markdown
+ *
+ * @since 2.8.0
+ *
+ * @param string $url Markdown support URL.
+ */
return apply_filters( 'easy_markdown_support_url', 'http://en.support.wordpress.com/markdown-quick-reference/' );
}
@@ -429,13 +438,25 @@ class WPCom_Markdown {
}
// rejigger post_content and post_content_filtered
// revisions are already in the right place, except when we're restoring, but that's taken care of elsewhere
- if ( 'revision' !== $post_data['post_type'] ) {
+ // also prevent quick edit feature from overriding already-saved markdown (issue https://github.com/Automattic/jetpack/issues/636)
+ if ( 'revision' !== $post_data['post_type'] && ! isset( $_POST['_inline_edit'] ) ) {
+ /**
+ * Filter the original post content passed to Markdown.
+ *
+ * @module markdown
+ *
+ * @since 2.8.0
+ *
+ * @param string $post_data['post_content'] Untransformed post content.
+ */
$post_data['post_content_filtered'] = apply_filters( 'wpcom_untransformed_content', $post_data['post_content'] );
$post_data['post_content'] = $this->transform( $post_data['post_content'], array( 'id' => $post_id ) );
+ /** This filter is already documented in core/wp-includes/default-filters.php */
$post_data['post_content'] = apply_filters( 'content_save_pre', $post_data['post_content'] );
} elseif ( 0 === strpos( $post_data['post_name'], $post_data['post_parent'] . '-autosave' ) ) {
// autosaves for previews are weird
$post_data['post_content'] = $this->transform( $post_data['post_content'], array( 'id' => $post_data['post_parent'] ) );
+ /** This filter is already documented in core/wp-includes/default-filters.php */
$post_data['post_content'] = apply_filters( 'content_save_pre', $post_data['post_content'] );
}
@@ -508,6 +529,16 @@ class WPCom_Markdown {
if ( $args['unslash'] )
$text = wp_unslash( $text );
+ /**
+ * Filter the content to be run through Markdown, before it's transformed by Markdown.
+ *
+ * @module markdown
+ *
+ * @since 2.8.0
+ *
+ * @param string $text Content to be run through Markdown
+ * @param array $args Array of Markdown options.
+ */
$text = apply_filters( 'wpcom_markdown_transform_pre', $text, $args );
// ensure our paragraphs are separated
$text = str_replace( array( '</p><p>', "</p>\n<p>" ), "</p>\n\n<p>", $text );
@@ -527,6 +558,16 @@ class WPCom_Markdown {
$text = preg_replace( '/((id|href)="#?fn(ref)?):/', "$1-", $text );
// Markdown inserts extra spaces to make itself work. Buh-bye.
$text = rtrim( $text );
+ /**
+ * Filter the content to be run through Markdown, after it was transformed by Markdown.
+ *
+ * @module markdown
+ *
+ * @since 2.8.0
+ *
+ * @param string $text Content to be run through Markdown
+ * @param array $args Array of Markdown options.
+ */
$text = apply_filters( 'wpcom_markdown_transform_post', $text, $args );
// probably need to re-slash