Skip to content

Out-of-the-box highlighting for IEC 61131-3 Structured Text (Prism iecst) + a seam to register extra grammars #1192

Description

@andreiyurik

Use case

We run an open education platform for industrial trades (Rails 8.1, importmap, Action Text + Lexxy). Our PLC programming lessons contain IEC 61131-3 Structured Text (ST) — the standard programming language of industrial automation. Today we mark those blocks as pascal (the conventional alias Rouge uses server-side), but the real language is ST, and highlighted ST samples are core content for this audience, not a nice-to-have.

What happens

The bundled Prism build ships ~20 grammars (bash, c, cpp, go, java, js, json, kotlin, php, python, ruby, rust, sql, swift, ts, xml, …). Neither iecst nor pascal is among them, so an ST code block stays unhighlighted — both live in the editor and in rendered content via the exported highlightCode().

And since the Prism instance isn't exported from the package, an app can't register additional grammars from prismjs on its own — there's no seam to extend the language set.

Why out-of-the-box support matters here

  • ST is the lingua franca of PLC programming; industrial/technical education is a real audience for Action Text apps, well beyond web development.
  • The people writing these lessons are trade experts, not JS developers. In a no-build importmap app there is no reasonable way for them (or us) to patch a vendored bundle.
  • PrismJS already ships an iecst grammar (“Structured Text (IEC 61131-3)”), so bundling it should be a build-config one-liner — and it would appear in the editor's code-language picker too.

Ask

  1. Include iecst (and ideally pascal) in the bundled grammar set — first-class, out-of-the-box ST support.
  2. Additionally (and more generally): export the Prism instance or a small registerLanguage hook, so apps can load any extra grammar from prismjs themselves.

Happy to send a PR for whichever direction you prefer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions