Opened 10 years ago
Last modified 7 years ago
#2730 new idea
Add Support For Jetpack Markdown
Reported by: | jeffr0 | Owned by: | |
---|---|---|---|
Milestone: | 2.7 | Priority: | normal |
Severity: | normal | Version: | |
Component: | General - Content Creation | Keywords: | has-patch |
Cc: |
Description
Based on this forum thread, https://bbpress.org/forums/topic/integrate-with-jetpack-markdown/ add support for Markdown in general or specifically when the Markdown Module in Jetpack is activated.
Change History (8)
#1
@
10 years ago
- Component changed from General to Content Creation
- Milestone changed from Awaiting Review to 2.7
- Summary changed from Add Support For Markdown to Add Support For Jetpack Markdown
#2
@
10 years ago
the author of this support topic https://bbpress.org/forums/topic/integrate-with-jetpack-markdown/ created this plugin that gets most of the work done.
https://github.com/jawittdesigns/Jetpack-Markdown-for-bbPress
#5
@
9 years ago
Hey guys,
I have a solution for this.
in bbpress/includes/common/formatting.php line 95
/** * Filter the topic or reply content and output code and pre tags * * @since bbPress (r4641) * * @param string $content Topic and reply content * @return string Partially encodedd content */ function bbp_code_trick( $content = '' ) { if( class_exists( 'Jetpack' ) && !Jetpack::is_module_active( 'markdown' ) ) { // if JetPack is active but Markdown module not active $content = str_replace( array( "\r\n", "\r" ), "\n", $content ); $content = preg_replace_callback( "|(`)(.*?)`|", 'bbp_encode_callback', $content ); $content = preg_replace_callback( "!(^|\n)`(.*?)`!s", 'bbp_encode_callback', $content ); } elseif( class_exists( 'Jetpack' ) && Jetpack::is_module_active( 'markdown' ) ) { // if JetPack is active but Markdown module is active add_post_type_support( bbp_get_topic_post_type(), WPCom_Markdown::POST_TYPE_SUPPORT ); add_post_type_support( bbp_get_reply_post_type(), WPCom_Markdown::POST_TYPE_SUPPORT ); } else { // if JetPack is not active $content = str_replace( array( "\r\n", "\r" ), "\n", $content ); $content = preg_replace_callback( "|(`)(.*?)`|", 'bbp_encode_callback', $content ); $content = preg_replace_callback( "!(^|\n)`(.*?)`!s", 'bbp_encode_callback', $content ); } return $content; }
First it check if jetpack is activated but the Markdown module is not activated, it returns the default bb_code_trick
Then if Jetpack is activated and the Markdown module is activates, it adds the markdown support to topic ad reply post type while excluding the default bb_code_trick
else it returns to the bb_code_trick
#6
@
7 years ago
- Keywords has-patch added
See: https://github.com/stuttter/bbp-jp-markdown
We can turn this into a core extension (in bbPress proper) very easily.
#7
follow-up:
↓ 8
@
7 years ago
Another twist. bbPress's code-tag trick is a bit long in the tooth, IMO.
I think we should just support the entire Markdown syntax, as it's become pretty de facto for most forum softwares.
#8
in reply to:
↑ 7
@
7 years ago
Replying to johnjamesjacoby:
Another twist. bbPress's code-tag trick is a bit long in the tooth, IMO.
Agreed
I think we should just support the entire Markdown syntax, as it's become pretty de facto for most forum softwares.
Yes please, which Markdown standard are we going to use?
- Gutenberg has gone with CommonMark spec + via the markdown-it package (online demos here and here)
- Jetpack uses the following PHP libraries: Markdown, Markdown Extra, and GitHub Flavored Markdown https://github.com/Automattic/jetpack/tree/400504bbcd5d9f9a8bdf4be921c10fde9756181d/_inc/lib/markdown
Thanks for the ticket, adding to 2.7 to take a look then.