The physics markup language

The physics markup language (pml) is a language for authoring and editing educational physics text that will be rendered using HTML, so it is designed for websites that need to represent physics accurately, and where it's assumed that the ability to maintain the website is important. The language is rather simple to extend, and so can be adapted to local needs, for example extensions for supporting physics teaching coaches, or rendering multiple choice questions. You can write in any text processor, and then a live server can render web pages as you type, using a javascript parser to render the page. The authors or editors are assumed to be physics graduates or be working closely with such people, and a knowledge of their competences and styles of thinking frames the design. There is assumed to be at least some supervisory teaching intelligence, so whereas the design and implementation should minimise syntactical error, semantic errors necessarily remain the responsibility of the humans. However, because it is just plain text, and many tools exist to deal with multiple text files, it’s somewhat easier to reduce inconsistencies and to hunt down infelicities. A further design constraint is that expressing physics requires precision beyond correctly punctuated English: there are technical conventions which have to appear in-line as well as in blocks by themselves.

Some examples



8 × 107 J K-1

10–20 metre

V 2 × R

pml relies on a set of camlecase words, such as "FractionBlock" and "ValueExponent", and parameters provided in curly braces, such as "{mass}{volume}" and "{10}{20}{metre}". pml provides a set of rules, written into parsing scripts, that transform combinations of these special elements embedded in other plain text to standards-compliant html, which can be displayed by any browser. Wrapping such output can then provide web pages. Matched to appropriate css files, you can get output such as this page.

A manual:

Starter & code on Github