Portable Document Markup Language (PDML) is a library to output PDF using PHP and an HTML-like markup language.
The "getting started" page describes how to use it: install the library, create a PHP file starting with <?php include "pdml.php" ?> and start outputting PDML.
The PDML will be automatically converted to a PDF file using the FPDF class.
I was curious how this works, as it seemed pretty different from previous similar libraries (PDFLib, FPDF), that offered a programmatic API to generate PDF DOMs instead of a markup language.
Looking at the very end of pdml.php you can notice a call to ob_start("ob_pdml"), with ob_pdml being defined above as function ob_pdml($buffer).
That turns out to be the key. Check out the documentation for the ob_start PHP function.
ob_start will turn output buffering on and will give the callback function a chance to process it. That's the trick for this seamless custom markup conversion using PHP ;-)
I wonder if Flash could be similarly outputted from PHP using a markup language (that would wrap the Ming library).
There could also be an Excel markup language, based on PHP Spreadsheet_WriteExcel, or an image markup language to generate PNG and JPEG image using the GD graphics library.
Update: Simon and some commenters on his site came up with other uses of this custom markup language technique: running XSLT or Html Tidy on this second layer of processing.
Harry Fuecks mentioned a very cool technique to have Apache automatically prepend the file with the extra PHP tag (using php_value auto_prepend_file myPhpInclude.php in the .htaccess).
I wonder if something like ob_start is available in ASP.Net...
ASP.Net does support a similar "second pass processing" technique. The "Intercept and modify the output created from a ASP.Net page" article describes how to do that. This relies on setting an output Filter on the HTTPResponse class.
Using inline aspx, it should be possible to have something very similar to PDML. I guess it would even be possible to write server-side controls to output blocks.
Gzip your CSS using the ob_start PHP trick (and the auto_prepend_file configuration in Apache).