quarto-dev / quarto-cli

Open-source scientific and technical publishing system built on Pandoc.
https://quarto.org
Other
3.96k stars 326 forks source link

embedded quizzes with julia fail for revealjs #6573

Open sebacea opened 1 year ago

sebacea commented 1 year ago

Hi, here i have a code to embed quizzes in quarto with julia. Nevertheless, rendering to format: revelajs does not work. Here the example:

---
title: "Questions"
format: html
editor: visual
jupyter: julia-1.9
---

## Embedded quizzes

Quarto enables you to embedd quizzes

This function requires an $\text{specific answer}$, Which one?

```{julia}
#| hold: true
#| echo: false
using QuizQuestions
lh_choices = [
"``\\text{this answer}``",
"``\\Lambda\\eta 0\\tau h3r``",
"``\\text{specific answer}``"
]
  answ =3
  radioq(lh_choices, answ, keep_order=true)```
cscheid commented 1 year ago

Thanks for the report. Can you be more specific than "does not work"? It might be helpful for you to compare the output generated by quarto with the output you get in a jupyter notebook, by using keep-ipynb: true and inspecting the intermediate .ipynb file.

sebacea commented 1 year ago

Thanks @cscheid , sure, here you have the output in HTML and in Revealjs

format: html

ezgif-2-7dc3d3da55

format: revealjs

Captura de pantalla 2023-08-21 a las 20 32 31
cscheid commented 1 year ago

The issue here is that RevealJS is not exactly compatible with the HTML+JS that this package is emitting. You can verify this by inspecting the output in your web browser:

image

Note the "0" height in the outer div. I suspect what's happening here is that this package uses MathJax to render the content dynamically, and because this slide is not visible when this is created, the resulting elements have height 0.

cscheid commented 1 year ago

@cderv do you remember what is the revealjs setting that controls "how many slides are visible" or something like that? I remember a similar issue with layout computation (I think it was in plotly charts?)

cderv commented 1 year ago

do you remember what is the revealjs setting that controls "how many slides are visible" or something like that?

It is view-distance but default is 3 and here there is only 2 slides. Changing the value does not seem to help. It seems to be something else related at how revealjs works and calculate sizes of element.

It seems there is conflict with the JS + CSS of this specific output from Julia package and revealJS own process. Finding what impact this in revealJS process will help us find a workaround (if any).

Probably something related to order of script execution... 🤔

cderv commented 11 months ago

We'll check this when updating revealjs

cderv commented 1 month ago

Revealjs updade did not help with that. This is definitely a conflict between QuizQuestions Julia package and Revealjs.

I found out that Julia creates HTML DOM which contains

<div class="controls">

And this directly conflicts with Revealjs own controls and its CSS rules applying on .controls

There is a diplay none hence why it does not show. Removing it show the quizz, but as a Revealjs Controls.

Image

So it is more complex problem that I thought... 🤔