Support » Fixing WordPress » How does WordPress convert Markdown string to HTML string?

  • Resolved uanaoeng

    (@uanaoeng)


    Hi! I want to understand how markdown works in WordPress.

    When I use the markdown editor to save the article, is the Markdown string or converted HTML string saved to the database?

    If it is markdown, then, when I read the article, how does WordPress parse markdown into HTML?

    Thanks a lot!

    • This topic was modified 3 months, 2 weeks ago by uanaoeng.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    The default WP editor does not accept markdown, you must be using an add-on editor through your theme or plugin. For example, the markdown accepted in these forums is managed by a modified version of bbPress. Your question would be best answered by the devs of the responsible module. There is typically a dedicated support channel you can use for that.

    You can investigate how the article is saved in the DB by checking the data through phpMyAdmin (usually accessed through your hosting control panel). If you see HTML there, obviously the conversion is done before writing to the DB. If you see markdown still, the conversion is probably done through code added to “the_content” filter. This allows themes and plugins to process content before output.

    @bcworkz Thank you, bcworkz!

    I found that some editor plugins such as WP Githuber MD store HTML string, while some such as Parsedown Party store Markdown string.

    Moreover, it’s the editor plugin, not the theme, that converts markdown string to html string.

    • This reply was modified 3 months, 2 weeks ago by uanaoeng.
    • This reply was modified 3 months, 2 weeks ago by uanaoeng.
    • This reply was modified 3 months, 2 weeks ago by uanaoeng.
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.