Using HTML components more than once

On my webpage I have a page using an HTML component and it works fine. The component is labelled HTML.
I have three other pages which I am trying to use HTML components and I name them OPPONENTS, GSLAM and EARNINGS as I understand that HTML components must have different names.

However, each of these crash Elements and I get a long message saying there is an error. Any idea how to fix this issue?

This is what Claude told me:
The good news: your code isn’t the problem. Your HTML/JS is well-formed — clean data array, valid Grid.js setup, no syntax errors that I can find.

What’s actually crashing is Elements’ own internal code editor, not your script. Look closely at the error dump: it’s dumping out monaco.languages.register(...) and monaco.languages.setMonarchTokensProvider('elementsHTML', ...) — that’s Elements’ own Monaco editor source code, the part it uses to build a custom “elementsHTML” syntax-highlighting language for its inspector/code view. Monaco is the code-editor engine (same one VS Code uses) that Elements embeds for the HTML/opp inspector panel.

So this is a bug in Elements’ Monaco language-registration routine — something in how it tries to tokenize/highlight your pasted content for display is throwing a JS exception, not a problem with your HTML executing.

A few things that commonly trigger this kind of Monaco tokenizer crash in RapidWeaver Elements:

  1. Duplicate element name/ID collision — you mentioned this element is named “OPPS” while another page has one named “HTML”. If Elements registers its custom language by a fixed id (elementsHTML) tied to element type rather than name, having two HTML-type elements can sometimes cause a re-registration conflict when Monaco tries to register the same language id twice. This matches the error location exactly.
  2. Very large single script block — your file is ~780 lines with a big embedded JSON array. Monaco’s tokenizer occasionally chokes on huge single-line-equivalent embedded scripts if it tries to re-tokenize the whole thing synchronously.
  3. A stale/corrupted Monaco instance in that project file — sometimes quitting Elements fully and reopening the project clears it.

What I’d try, in order:

  • Quit and relaunch Elements completely (not just close/reopen the project) — Monaco language registration is usually per-app-session, so a leftover “elementsHTML” registration from the other page could be the conflict.
  • If it still crashes, try pasting the code into a brand new HTML element on a blank test page (not named OPPS) and see if it behaves — this isolates whether it’s the element name/id specifically.
  • As a workaround, paste the code in smaller chunks (structure/style first, save, then add the script block) to see if a partial paste succeeds, which would point to Monaco’s tokenizer, not your code, as the crash trigger.

Write a message…

Hi @irishchristo

I replied to your email about this a few hours ago, testing the project file and two HTML file samples you sent over. I was unable to reproduce the crash on my end. Not sure if you received that reply.

Can you confirm you are on the latest beta version 3.0.9 of Elements?

Did you want to jump on a Zoom call so I can see this happening in real-time?

This was resolved, issue was an HTML file was trying to be dragged into the HTML editor which won’t work.

For HTML components, the code needs to be copied and pasted into the editor, or written directly in the editor. :slightly_smiling_face: