basecamp / basecamp/lexxy

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

Open
#1,192 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.2k
Forks
119
Avg merge
4d 8h
Merged PRs (30d)
15

Description

## 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.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing the bundled Prism build, the exported highlightCode(), and the editor's code-language picker to see how grammars are selected and exposed. Done means IEC 61131-3 Structured Text is available as iecst (and, if accepted, pascal) in editing and rendered content, with a documented seam for registering additional PrismJS grammars.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.