Skip to content

New question type: fill in the blanks #9

@ewels

Description

@ewels

I was poking around in the Network tab at the various forks of this repo and spotted https://github.com/kjanat/mkdocs-exam by @kjanat

This has several new question types, the one I like best is:

Fill in the blank

Use three underscores (___) as placeholder in your question and provide the correct answer.

<exam>
type: fill
question: 2 + 2 = ___
answer-correct: 4
content:
<p>A simple addition problem.</p>
</exam>

Thinking of equivalent syntax in the new mkdocs-quiz syntax is not easy. The most literal translation would be:

<quiz>
2 + 2 =  ___
- [x] 4
</quiz>

However I think I prefer using placeholders instead of underscores. Need to be careful not to clash with Jinja / markdown syntax etc. Maybe double square brackets?

<quiz>
2 + 2 =  [[4]]
</quiz>

Could then try to be clever and even have multiple inputs, and markdown styling:

<quiz>
Fill in the well known idiom:

> _The quick brown [[fox]] jumped over the lazy [[dog]]_
</quiz>

Would generate something like this:

<!-- normal mkdocs-quiz framing -->
<quiz>
Fill in the well known idiom:

<blockquote>
  <em>
    The quick brown
    <input type="text" class="mkdocs-quiz-input" data-mkdocs-quiz-answer="fox" />
    jumped over the lazy
    <input type="text" class="mkdocs-quiz-input" data-mkdocs-quiz-answer="dog" />
  </em>
</blockquote>
<!-- normal mkdocs-quiz framing -->

With some CSS styling to make the <input> elements display inline and with nice styling.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions