Skip to:
Content
Pages
Categories
Search
Top
Bottom

Integrate with Jetpack Markdown


  • jawittdesigns
    Participant

    @jawittdesigns

    I’m trying to integrate bbPress with Jetpack Markdown.

    The problem I’m having is the formatting of the saved data.

    If I leave bbPress as is.The fenced code blocks with the three back-ticks get all screwy. I’ve found this is because of the bbp_code_trick() function on the bbp_new_reply_pre_content filter.

    If I remove that filter the fenced code block works, but the inline code doesn’t. Somewhere the & character is being escaped to & and messing everything up. For instance, instead of < it ends up being saved to the database as &<. I cannot find where this is happening.

Viewing 8 replies - 1 through 8 (of 8 total)

  • Robkk
    Moderator

    @robkk

    does this plugin help your situation??

    https://wordpress.org/plugins/jetpack-markdown-support/


    jawittdesigns
    Participant

    @jawittdesigns

    No, that adds custom post type support by looping through the custom post types using the add_post_type_support() function. I already have that set.


    jawittdesigns
    Participant

    @jawittdesigns

    I still haven’t been able to find where the & character conversion is taking place, but I have managed to get it to work.

    Here’s the class I’m using

    class JPM_BBP_Support {
    
        /**
         * Initialize the class and set its properties.
         */
        public function __construct() {
            add_action( 'plugins_loaded', array( $this, 'custom_jetpack_markdown_support' ) );
            // Remove the back_code_trick filter
            remove_filter( 'bbp_new_reply_pre_content',  'bbp_code_trick',  20 );
            remove_filter( 'bbp_new_topic_pre_content',  'bbp_code_trick',  20 );
            remove_filter( 'bbp_new_forum_pre_content',  'bbp_code_trick',  20 );
            remove_filter( 'bbp_edit_reply_pre_content', 'bbp_code_trick',  20 );
            remove_filter( 'bbp_edit_topic_pre_content', 'bbp_code_trick',  20 );
            remove_filter( 'bbp_edit_forum_pre_content', 'bbp_code_trick',  20 );
    
            add_filter( 'bbp_get_reply_content', array( $this, 'custom_con_char' ), 6 );
            add_filter( 'bbp_get_topic_content',  array( $this, 'custom_con_char' ), 6 );
        }
    
        /**
         * Replace instances of < and >
         * with < and > when pulling the content
         * from the databse to display
         * 
         * @param  string $content the content stored in the database
         * @return string          the formated content
         */
        public function custom_con_char( $content = '' ) {
            $content = str_replace( '<', '<' , $content );
            $content = str_replace( '>', '>' , $content );
            return $content;
        }
    
        /**
         * Add Markdown support for BBPress Froums
         */
        public function custom_jetpack_markdown_support() {
            add_post_type_support( 'topic', 'wpcom-markdown' );
            add_post_type_support( 'reply', 'wpcom-markdown' );
        }
    }
    
    $jmp_bbp_support = new JPM_BBP_Support();

    Robkk
    Moderator

    @robkk

    @jawittdesigns

    hopefully @netweb or @robin-w will pick this up since they browse the bbpress plugin files way more than i do.


    Stephen Edgar
    Keymaster

    @netweb

    Create a ticket on Trac and we’ll take a look at adding support for Jetpack Markdown

    https://bbpress.trac.wordpress.org/


    Jeff Chandler
    Participant

    @jeffr0

    I’ve created a ticket in Trac at the request of @netweb https://bbpress.trac.wordpress.org/ticket/2730


    chriscoyier
    Participant

    @chriscoyier

    Howdy team!

    Has there been any new work on getting Markdown working in bbPress?

    @jawittdesigns’s plugin seems to have stopped working for me. So now I have these forums that have loads of Markdown content and say that they support Markdown, but don’t.

    I’m not entirely sure what to do.


    John James Jacoby
    Keymaster

    @johnjamesjacoby

Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.
Skip to toolbar