Hi! We added the custom tags support to make possible a definition of features, not achievable with the standard HTML approach, for example a support of SVG vector graphics or MathML. It you need a simple content or HTML markup injection, the custom tags seem to be an overkill.

First, do not forget that the input of PD4ML is HTML. You may always pre-process it as a text before it is passed to readHTML(). Let’s say, define your proprietary placeholders in HTML and substitute them with actual data before PD4ML takes part. In the case “the actual data” can be either content string or HTML markup.

In the case you need to insert only text content, you may use PD4ML’s template mechanism. Define in your HTML placeholders in the format: $[var] ($[page], $[total] and $[title] are reserved) and substitute them with the API call:


The advantage of the method is that you do not need to pre-read HTML to a buffer (if it is read-only or comes from HTTP) to pre-process. Disadvantage: you cannot pass HTML markup via the templating mechanism.

There is also injectHtml() API call, but it allows to inject HTML portion either immediately after opening <body> or jus before the closing BODY tag.

Or do you have a very special usage scenario, the above does not help?