Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend functionality to include document types to output solutions and questions at the same time #2

Merged
merged 9 commits into from Aug 10, 2023

Conversation

MikeLydeamore
Copy link
Contributor

Based on the Unilur document formats, I have extended the extension to include two different output formats:

  • unilur-question
  • unilur-solution

This allows quarto render to output the two files in one pass, one including a solution and one including only the questions. Unfortunately you can't specify the same output type twice with different chunk options, hence the need for two (almost) identical extensions.

I have also updated the lua filter to allow for divs (651a4a8) to better embed text + code, or just text on it's own, or really anything that fits inside a div.

Existing functionality is unchanged, except for the output format. The old YAML options still work even if not including the new output types.

@ginolhac
Copy link
Owner

Waouh ! I am still amazed by FOSS.
I didn't expect this extension to receive a PR, thanks!
I am away until first of August but will happily look at it when I am home.
Cheers Mike

@ginolhac
Copy link
Owner

ginolhac commented Aug 1, 2023

Hey @MikeLydeamore ,
I like the idea of generating both files at the same time. Thanks!
I have seen extension that have multiple formats sharing the same filter but no indeed, not twice html. Would be nice, I am a little reluctant to have twice the same lua filter.
For the div , can you explain what is the expected results? the whole div is tagged with class unilur-solution is removed?

@MikeLydeamore
Copy link
Contributor Author

Hi,
Yes I'm also not thrilled about the duplicated filter, but I couldn't find another way to have the same output type twice, sharing the filter file.

Yes, that's the expected results for the div. The reason this is useful is for combining code and text inside the same solution. In the current format, you can include it in a block block, but then syntax highlighting doesn't work if you include a code chunk inside the block block.

@ginolhac
Copy link
Owner

ginolhac commented Aug 4, 2023

Ok, let's merge it and keep the duplication for now.
Can I ask you to commits 3 things before?

  • Add yourself as author
  • Add that both formats are rendered in one go with quarto render example.qmd it is not obvious it works
  • Add an example of your div idea such as:
::: unilur-solution

This text solution is inside a div. 

```{r}
2 + 6
```
:::

so we see directly
image

What do you think?

@MikeLydeamore
Copy link
Contributor Author

Good suggestions, I have added them now.

@MikeLydeamore
Copy link
Contributor Author

Hi @ginolhac, I asked on the Quarto Q&A about ways to do this without duplicating the filter, and it was suggested to use a + variant. I've added this and it works a treat.

I've updated the PR and example to reflect the single-extension system.

I think this is much cleaner, and also avoids the duplication concerns.

@ginolhac ginolhac merged commit 921ca38 into ginolhac:main Aug 10, 2023
@ginolhac
Copy link
Owner

Awesome @MikeLydeamore ! Truly awesome. Thanks a lot for finding this + trick, it is perfect now.
I updated the example and show the advantage of your div, to have running code and md text.
I experienced that some students in my courses were cheating, replacing the _question by _solution so I ended generating random strings like here mangaged by {targets}. Will need to check I can still render both files and control the output filename.
A quick test like this is not working, will need to check this later.

quarto render example.qmd -M html+solution:unilur-solution:output-file:example-solxyz.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants