PhpStorm 8: Markdown Support in PHPDoc Blocks

Since PhpDocumentor allows Markdown in documentation blocks (as stated here), we have added Markdown support to PhpStorm 8 too when showing a quick documentation of classes, functions, etc. Here is a list of what is actually supported from Markdown syntax specification, with some examples:

  • Paragraphs separated by one or more line breaks. There is a continuous flow of text inside a paragraph without line breaks from the original description.
  • Headers. You can use the following style, for example:

    or use the number sign (#):
  • Emphasis. A piece of text surrounded with underscore characters (_) or asterisks (*) is rendered as underlined. You can also use double asterisks (**) to make it bold. Note that if the underscore character appears inside a name, for example my_variable, it is left as is.
  • Lists. You can use asterisks (*) or short dashes (-) at the beginning of a line to mark a list item. For example:

    These will be translated to an HTML list as follows:

    • First item
    • Second item
    • Third item
  • Code blocks. Wrap the code into backtick quotes (`) as follows:

Note: It is possible to use HTML markup in combination with Markdown.

And finally, a larger sample:

The example above will be rendered like so:

phpdoc_render_sample

If you find anything that can be improved or is not working as expected, please share your feedback in the issue tracker. Thanks!

Develop with pleasure!
-JetBrains PhpStorm Team

This entry was posted in Cool Feature, Early Access Program and tagged , , , , . Bookmark the permalink.
  • http://www.yakirs.net/ Yakir Sitbon

    How I can use with this? I do not get any autocomplate or preview in my PHPDoc from the editor.

    Thanks.

    • rustam.vishnyakov

      It works in a quick documentation window (default shortcut Ctrl+Q). Basically you need to navigate to function/class and open the documentation window using the mentioned shortcut.

      • http://www.yakirs.net/ Yakir Sitbon

        Thanks.

    • http://www.yakirs.net/ Yakir Sitbon

      Sorry. This is get from CTRL+Q. Nice job :)

    • http://macr.ae/ Callum Macrae

      Are you using PhpStorm 8 EAP? The current stable release of PhpStorm (7.1) doesn’t have this functionality.

      • http://macr.ae/ Callum Macrae

        Can’t delete my comment, I was slow :(

      • Mikhail Vink

        Yes, PhpStorm 8 EAP, this feature is there. Version is mentioned in title of the blog post and intro.

  • http://maximals.ru MaximAL

    Underscores in Markdown are for italics. Aren’t they?

    • rustam.vishnyakov

      Both * and _ are translated to <em> which is just a semantic tag. Although you are right, browsers show a text inside <em> as italic.

      • http://maximals.ru MaximAL

        I mean emphasis, of course.
        IMHO, ems are preferable to be italics in PhpDocs by default.

        • http://twitter.com/rafi Rafi B.

          +1

    • rustam.vishnyakov

      Changed to italic (will be in EAP build after 136.1575)

  • Pingback: PhpStorm 8 - New Features