Embedding JavaScript (like CircuitJS)

5 views
Skip to first unread message

Stephan Boltzmann

unread,
Dec 17, 2025, 4:11:08 PM (2 days ago) Dec 17
to PreTeXt support
Hello everybody out there using PreTeXt,

ChemDoodle Web Compontents (https://web.chemdoodle.com/) is a JavaScript library implementing an interactive editor for chemical structures.
Is there a way to use it (or generally speaking a JavaScript library) in PreTeXt (HTML output)?

PreTeXt already supports CircuitJS interactives, which are great for interactive electronic schematics.
It would be great to have a similar way to embed ChemDoodle Web Components in PreTeXt!

Kind regards
Stephan

Andrew Scholer

unread,
Dec 17, 2025, 5:56:17 PM (2 days ago) Dec 17
to pretext...@googlegroups.com
Stephan - 

It is possible to add arbitrary HTML/JS to an iframe that becomes an "interactive". There are a few overlapping version of the <interactive> element that allow for this. 

The most general purpose one would be an <interactive> with @iframe that points to an html file in your external directory that loads the right JS/CSS libraries and then triggers whatever setup you want.

An <interactive> with @platform="javascript" works in a similar way, but can handle loading the JS/CSS libraries into the iframe automatically so that you can just provide the logic for loading your particular content.

Depending on your personal authoring methods and what you are authoring, you will likely find one or the other of those two methods works better for you.

Andrew Scholer

--
You received this message because you are subscribed to the Google Groups "PreTeXt support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pretext-suppo...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/pretext-support/373fe3f5-af76-4b69-8338-4833d98ddc46n%40googlegroups.com.

Rob Beezer

unread,
Dec 18, 2025, 12:09:32 PM (2 days ago) Dec 18
to pretext...@googlegroups.com
Dear Stephan,

Are you writing a chemistry textbook?

Rob
> --
> You received this message because you are subscribed to the Google Groups
> "PreTeXt support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to pretext-suppo...@googlegroups.com <mailto:pretext-
> support+u...@googlegroups.com>.
> To view this discussion visit https://groups.google.com/d/msgid/pretext-
> support/373fe3f5-af76-4b69-8338-4833d98ddc46n%40googlegroups.com <https://
> groups.google.com/d/msgid/pretext-support/373fe3f5-
> af76-4b69-8338-4833d98ddc46n%40googlegroups.com?utm_medium=email&utm_source=footer>.

Reply all
Reply to author
Forward
0 new messages