Archive

Posts Tagged ‘useful’

Using HTML tags in PHPDoc blocks

June 25th, 2008

As my involvement in the dev side of WordPress grows, I’ve been working on increasing the PHPDoc comments through the major parts of the code. A particular challenge I stumbled across today was trying to talk about certain HTML tags in the comments in a way that they wouldn’t then be turned into the actual tag when phpDocumentor ran.

So basically I wanted to say something like

This function returns a properly formatted <pre>…</pre> block

However I found that doing that caused the <pre> tag to be used as part of the page when the docs were transferred to the HTML format.

The solution I discovered was to reference the tags as <<pre>> or <<br />>. This seems to preserve the tag in the finished documentation as a comment and not part of the page.

I struggled to find this in google, so though a little blog post might just help someone.

 

PHP , ,