text2qti icon indicating copy to clipboard operation
text2qti copied to clipboard

Is it possible to export the markdown to well-looked pdf or html?

Open flcong opened this issue 3 years ago • 5 comments

Thank you very much for the package. It is very helpful since currently most exams are moved online. One issue is that, since the syntax here is not the same as the markdown syntax, (e.g. in multiple-answer questions, [*] will make ] italic), I wonder if there is a way to export the markdown into, e.g. pdf or HTML with the correct format (e.g. the correct choice could be in bold).

flcong avatar Nov 21 '20 21:11 flcong

There is not currently a way to do this. However, this is a feature I have been thinking about and something I need myself, since I sometimes need to generate standalone answer keys and also in some cases plain PDF or HTML versions of exams (not QTI). I'm marking this as a feature to add in the future. Unless someone else implements this before I do, probably the absolute earliest this could be available would be February.

Depending on the complexity of what you need, there may be ways to get something that works right now. For example, with multiple-answer questions, you could create a copy of the quiz file, and then use a regex to replace [ ] with * to turn incorrect answers into bullet points and replace [*] with * Correct: to mark correct answers. Depending on what you want the output to look like, you might also add indentation. You might also need to do a few additional things like strip out question point values (lines starting with Points: ). At least for a simple quiz, converting it into a decent Markdown approximation in this way might not be too difficult.

gpoore avatar Nov 22 '20 01:11 gpoore

Thank you. Now I plan to use LaTeX first and then use python to parse LaTeX to convert it to the markdown format. There is actually a project converting LaTeX to QTI. However, multiple-answer questions are not supported there, but I need them.

flcong avatar Nov 22 '20 02:11 flcong

I short-run workaround is to use the rpy2 module to call the "exams2html" or "exams2pdf" function from the "exams" package in R. This isn't elegant but could work.

wsphd avatar Dec 20 '20 05:12 wsphd

There is now basic support for exporting solutions in Pandoc Markdown, PDF, and HTML formats in the dev version on GitHub. See --solutions and --only-solutions. I may refine this a bit further before I release a new version and update PyPI, but I'm already using it myself.

gpoore avatar Apr 18 '21 04:04 gpoore

There is now basic support for exporting solutions in Pandoc Markdown, PDF, and HTML formats in the dev version on GitHub. See --solutions and --only-solutions. I may refine this a bit further before I release a new version and update PyPI, but I'm already using it myself.

Thank you!

flcong avatar Apr 19 '21 03:04 flcong