Code blocks error (2 posts)

  1. kemelzaidan
    Posted 1 year ago #


    I know markdown implementations vary a bit, but all markdown exporters I've used convert ` (triple backticks) code block to <pre><code>. This seem to be true since <pre> tags don't introduce <br> tags inside the code block, which is often desirable.

    The problem is that I wan't to use wp-markdown together with wp-highlight.js and that needs code blocks to be this way, with the <pre> tag.

    If that isn't desirable to all, maybe an option to choose between the two could be useful.

    Thanks in advance.


  2. Stephen Harris
    Plugin Author

    Posted 1 year ago #

    Markdown doesn't use triple backtics for code blocks, but instead code blocks should be separated by a blank line and indented by 4 or more spaces.

    Github-flavoured markdown (which isn't strictly speaking markdown) implements triple backtics. While it's possible to implement it, GFM breaks with markdown in a number of ways so the plug-in wouldn't be true to what it says it'll do or it'll have some weird hybrid of markdown and GFM markdown :). (Reminds me somewhat of http://xkcd.com/927/ :) ).

    I'm open to pull requests which add an option which essentially replaces markdown with GFM, but I'm afraid it's something I don't have the time for currently.

    But you can use Highlight.js with markdown, Marcin has created this plug-in: https://github.com/mczenko/wp-markdown-code-highlighting-options. Someone has also this plug-in which seems to do exactly the same thing: http://wordpress.org/plugins/wp-markdown-syntax-sugar/. Both it appears allows you to use wp-markdown, with wp-highlight.js.

    ... I should add a link to those plug-ins as a couple of times people have asked about wp-highlight.js support.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP-Markdown
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.