Jetpack by WordPress.com
[resolved] Adding Markdown support to Plugins: Paragraphs (3 posts)

  1. jezza101
    Posted 1 year ago #

    I have added markdown support to a meta field in a custom plugin using the suggestion here.

    WPCom_Markdown::get_instance()->transform( $content )

    This works fine with the exception of paragraphs (I understand these are inserted by inserting two or more spaces and pressing return).

    In the above example, $content is simply the contents of a post meta field collected from a text area. I then echo the result of the transform. Note that I do set unslash to false as I am using the content of my meta form directly.

    Paragraphs aren't showing up, and whats more I can't even use html p tags! Any suggestions?

    Many thanks.


  2. jezza101
    Posted 1 year ago #

    I worked it out.

    Turns out this is less to do with JetPack and more with how WordPress handles paragraphs and sanitisation of meta fields.

    I added the solution to my post on the topic here. Hope that is useful to someone in the future :)


  3. Richard Archambault
    Happiness Engineer
    Plugin Author

    Posted 1 year ago #

    Great post, thanks!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Jetpack by WordPress.com
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic