Embedding numbas questions

6 views
Skip to first unread message

William Haynes

unread,
Jan 12, 2026, 10:07:42 PM (7 days ago) Jan 12
to Numbas Users
Hi Christian,

I have been experimenting with embedding numbas content into other pages as described in  https://docs.numbas.org.uk/en/latest/embedding.html, and I've run into two issues which I need some help with.

Results can be seen here: https://whaynes.github.io/numbas/
Based on the code here:  https://github.com/whaynes/numbas

1.  The questions seem to be reserving space for the advice, but I would like that space to be collapsed until it is needed.

2.  The first and third question use image files in their advice.  These images are stored in each question's resources/question-resources directory, but the common code is looking for question-resources in the top level resources directory so the images aren't found.  How can I make this work without merging all question-resources into the top level directory?

Will

Christian Lawson-Perfect

unread,
Jan 13, 2026, 4:47:28 AM (6 days ago) Jan 13
to numbas...@googlegroups.com
1. There's a rule `min-height: var(--exam-height, 0)` applied to the exam container. The default value for --exam-height is 100svh, the full height of the viewport. You could try setting it to 0 in a custom theme.

2. Change the image's src attribute to match the layout of your repository. URLs in question content don't get rewritten at runtime, so I don't think there's a better solution than that. 

--
You received this message because you are subscribed to the Google Groups "Numbas Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to numbas-users...@googlegroups.com.
To view this discussion, visit https://groups.google.com/d/msgid/numbas-users/6f724596-a174-415a-a8c8-fff5c649e77dn%40googlegroups.com.

William Haynes

unread,
Jan 15, 2026, 10:06:46 AM (4 days ago) Jan 15
to Numbas Users
Thanks,

1. Works great.
2. Works, but inconvenient.  I know that I won't remember to hand edit the image src after I make changes to a question. :(

Would this be better addressed with a theme?  I see this issue: A theme that works well when embedded in a very small space, which is what I am trying accomplish.  I could try to write a theme to do that.

Will

Christian Lawson-Perfect

unread,
Jan 15, 2026, 10:32:20 AM (4 days ago) Jan 15
to numbas...@googlegroups.com
I can't see how a theme would help you with the relative URLs to question resources.

Reply all
Reply to author
Forward
0 new messages